0

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.

Das
  • 470
  • 5
  • 20

1 Answers1

0

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>
Russ
  • 678
  • 8
  • 26
  • Thanks for the reply Russ, I've heard from others I can ignore the warning in the config file, but the exception that throws is where I'm stuck at. Do you happen to know where the second variable in the "type" comes from? The one in your example setup as `GZipMessageEncoder`. I'm wondering if because I put the Gzip code in a project with other utility pieces it's causing the issue as I didn't 100% follow what was put in other answers. Trying it that way is my next attempt! – Das Dec 26 '18 at 15:00
  • 1
    From https://blogs.msdn.microsoft.com/carlosfigueira/2011/07/25/wcf-extensibility-binding-and-binding-element-configuration-extensions/ The type is `type="MyNamespace.MyBindingElementExtension, MyAssemblyName` – Russ Dec 27 '18 at 00:52