简体   繁体   中英

IRS-A2A Invalid Child Elements gzipMessageEncoding in App.config

I am working on integrating the A2A channel for the IRS through their WSDL and currently stuck on an issue in my App.config. Currently there is a warning for the <gzipMessageEncoding/> node of my App.config:

The element 'binding' has invalid child element 'gzipMessageEncoding'. List of possible elements expected: (...).

I've looked over solutions provided by fatherOfWine, Russ, and jstill primarily here and I've gotten stuck now on this config hiccup. From what I've researched people seem to say you can just ignore this as a warning and continue but attempting to send to the IRS leads to the following error.

Invalid element in configuration. The extension 'gzipMessageEncoding' does not derive from correct extension base type 'System.ServiceModel.Configuration.BindingElementExtensionElement'.

Below is the snippet of my service model config. I have the encoder in a different place than fatherOfWine had suggested but I believe I have the correct types setup.

  <system.serviceModel>
    <client>
      <endpoint address="[Endpoint Address]"
      binding="customBinding" bindingConfiguration="BulkRequestTransmitterBinding"
      contract="ACABulkRequestTransmitterService.BulkRequestTransmitterPortType"
      name="BulkRequestTransmitterPort" />
      <metadata>
        <policyImporters>
          <extension type="GZipEncoder.GZipMessageEncodingBindingElementImporter, GZipEncoder, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
        </policyImporters>
      </metadata>
    </client>
    <extensions>
      <bindingElementExtensions>
        <add name="gzipMessageEncoding" type="GZipEncoder.GZipMessageEncodingElement, GZipEncoder, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null" />
      </bindingElementExtensions>
    </extensions>  

    <bindings>
      <customBinding>
        <binding name="BulkRequestTransmitterBinding">
          <gzipMessageEncoding innerMessageEncoding="textMessageEncoding" />
          <httpsTransport />
        </binding>
      </customBinding>
    </bindings>
  </system.serviceModel>

UPDATE 1: Changing the second variable in the type field to GZipMessageEncoder throws a new exception at the same place.

'The type 'Utilities.Gzip.GZipMessageEncodingBindingElement, GZipMessageEncoder, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null' registered for extension 'gzipMessageEncoding' could not be loaded.'

Still going to try and move the gzip code into its own project like shown in the link above.

UPDATE 2: Moving the Gzip library into its own project seems to have helped resolve the exception thrown during runtime. I've gone ahead and updated my App.config file above with what has changed. I'm now at the same point/issue in both my current working methods! lol but it's probably best in a different question if it comes to that.

That is the same warning I am receiving when I review my App.config. It seems like you can ignore the warning; which indicates that there is a different issue with the way your code is setup.

Below is a snippet of my App.config having the appropriate elements:

<system.serviceModel>
  <customBinding>
    <binding name="BulkRequestTransmitterBinding" sendTimeout="00:15:00">
      <gzipMessageEncoding innerMessageEncoding="textMessageEncoding" />
      <httpsTransport />
    </binding>
    <client>
      <!-- Endpoints are setup by the import of the IRS Service so I will not include them here -->
      <endpoint for transmission />
      <endpoint for status />
      <metadata>
        <policyImporters>
          <extension type="[ProjectName].GZipMessageEncodingBindingElementImporter, GZipMessageEncoder, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
        </policyImporters>
      </metadata>
    </client>
    <extensions>
      <bindingElementExtensions>
        <add name="gzipMessageEncoding" type="[ProjectName].GZipMessageEncodingElement, GZipMessageEncoder, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null" />
      </bindingElementExtensions>
    </extensions>
  </customBinding>
</system.serviceModel>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM