none
ESB Relay with webHttpRelayBinding binding IIS hosting RRS feed

  • Question

  • Hello,

    I try to expose legacy LOB WCF service using webHttpBinding binding to the internet by refactoring it to use webHttpRelayBinding binding so it can be accessed through Azure ESB relay endpoint.

     

    The service operates as expected when self-hosted in console app but we are not successful so far using IIS as the hosting environment.

    We suspect that the issue we are facing is related to proper configuration of SSL support on our IIS server.

    I had no lack so far in finding any detailed info related to set up of relays in Azure and what is required to properly configure IIS to host HTTP based requests coming through the relay endpoint.

     

    Any help/input is appreciated

    Regards

    Jack

     

    Here is response I am currently getting

     

    <Reason>

     

    <Text xml:lang="en-US">The message with Action 'GET' cannot be processed at the receiver,

    due to a ContractFilter mismatch at the EndpointDispatcher.

    This may be because of either a contract mismatch (mismatched Actions between sender and receiver)

    or a binding/security mismatch between the sender and the receiver.

    Check that sender and receiver have the same contract and the same binding (including security requirements,

    e.g. Message, Transport, None).

    </Text>

     

    </Reason>

     

    Here is web.config

     

    <?xml version="1.0"?>

    <configuration>

     

      <appSettings>

        <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>

        <!-- Service Bus specific app setings for messaging connections -->

        <add key="Microsoft.ServiceBus.ConnectionString"

            value="Endpoint=sb://MyNamesapce.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=akey123456677777777777=;EntityPath=CalcSvc"/>

      </appSettings>

      <system.web>

        <compilation debug="true" targetFramework="4.5"/>

        <httpRuntime targetFramework="4.5"/>

      </system.web>

      <system.serviceModel>

        <protocolMapping>

          <add binding="webHttpRelayBinding" scheme="http"/>

        </protocolMapping>   

        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="false"/>

        <extensions>

          <!-- In this extension section we are introducing all known service bus extensions. User can remove the ones they don't need. -->

          <behaviorExtensions>

            <add name="connectionStatusBehavior"

              type="Microsoft.ServiceBus.Configuration.ConnectionStatusElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

            <add name="transportClientEndpointBehavior"

              type="Microsoft.ServiceBus.Configuration.TransportClientEndpointBehaviorElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

            <add name="serviceRegistrySettings"

              type="Microsoft.ServiceBus.Configuration.ServiceRegistrySettingsElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

          </behaviorExtensions>

          <bindingElementExtensions>

            <add name="netMessagingTransport"

              type="Microsoft.ServiceBus.Messaging.Configuration.NetMessagingTransportExtensionElement, Microsoft.ServiceBus,  Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

            <add name="tcpRelayTransport"

              type="Microsoft.ServiceBus.Configuration.TcpRelayTransportElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

            <add name="httpRelayTransport"

              type="Microsoft.ServiceBus.Configuration.HttpRelayTransportElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

            <add name="httpsRelayTransport"

              type="Microsoft.ServiceBus.Configuration.HttpsRelayTransportElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

            <add name="onewayRelayTransport"

              type="Microsoft.ServiceBus.Configuration.RelayedOnewayTransportElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

          </bindingElementExtensions>

          <bindingExtensions>

            <add name="basicHttpRelayBinding"

              type="Microsoft.ServiceBus.Configuration.BasicHttpRelayBindingCollectionElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

            <add name="webHttpRelayBinding"

              type="Microsoft.ServiceBus.Configuration.WebHttpRelayBindingCollectionElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

            <add name="ws2007HttpRelayBinding"

              type="Microsoft.ServiceBus.Configuration.WS2007HttpRelayBindingCollectionElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

            <add name="netTcpRelayBinding"

              type="Microsoft.ServiceBus.Configuration.NetTcpRelayBindingCollectionElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

            <add name="netOnewayRelayBinding"

              type="Microsoft.ServiceBus.Configuration.NetOnewayRelayBindingCollectionElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

            <add name="netEventRelayBinding"

              type="Microsoft.ServiceBus.Configuration.NetEventRelayBindingCollectionElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

            <add name="netMessagingBinding"

              type="Microsoft.ServiceBus.Messaging.Configuration.NetMessagingBindingCollectionElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

          </bindingExtensions>

        </extensions>

     

        <bindings>

          <!-- Application Binding -->

          <webHttpRelayBinding>

            <binding name="default" isDynamic="false">

              <security relayClientAuthenticationType="None" />

            </binding>

          </webHttpRelayBinding>

        </bindings>

        <services>

          <!-- Application Service -->

          <service name="CalcSvcIIS.CalcService"

               behaviorConfiguration="default">

            <endpoint name="RelayEndpoint"

                    contract="CalcSvcIIS.ICalcService"

                    binding="webHttpRelayBinding"

                    bindingConfiguration="default"

                    behaviorConfiguration="sbTokenProvider"

                    address="https://ESBPLay.servicebus.windows.net/CalcSvc" />

          </service>

        </services>

        <behaviors>

          <endpointBehaviors>

            <behavior name="sbTokenProvider">

              <transportClientEndpointBehavior>

                <tokenProvider>

                  <sharedAccessSignature keyName="RootManageSharedAccessKey" key="akey123456677777777777=" />

                </tokenProvider>

              </transportClientEndpointBehavior>

            </behavior>

          </endpointBehaviors>

          <serviceBehaviors>

            <behavior name="default">

              <!-- To avoid disclosing metadata information, set the values below to false before deployment -->

              <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>

              <serviceDebug includeExceptionDetailInFaults="true" httpHelpPageEnabled="false" httpsHelpPageEnabled="false" />

            </behavior>

          </serviceBehaviors>

        </behaviors>

     

      </system.serviceModel>

     

      <system.webServer>

        <httpProtocol>

          <customHeaders>

            <add name="Access-Control-Allow-Origin" value="*" />

            <add name="Access-Control-Allow-Headers" value="Content-Type" />

            <add name="Access-Control-Allow-Methods" value="POST, GET" />

            <!--<add name="Access-Control-Max-Age" value="1728000" />-->

          </customHeaders>

        </httpProtocol>

        <modules runAllManagedModulesForAllRequests="true" />

        <!--

            To browse web app root directory during debugging, set the value below to true.

            Set to false before deployment to avoid disclosing web app folder information.

          -->

        <directoryBrowse enabled="true"/>

     <applicationInitialization>

        <add initializationPage="/CalcService.svc" />

      </applicationInitialization>   

      </system.webServer> 

     

    </configuration>

     

    Monday, December 19, 2016 3:19 AM

All replies

  • turn off aspNetCompatibilityEnabled


    Frank

    Monday, December 19, 2016 3:33 PM
  • Thank you for the suggestion Frank,

    I flipped the flag but unfortunately it is not making any difference.

    Here is snippet from web.config

      <system.serviceModel>
        <protocolMapping>
          <add binding="webHttpRelayBinding" scheme="http"/>
        </protocolMapping>    
        <serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="false"/>
        <extensions>

    Regards

    Jack

     

    Tuesday, December 20, 2016 6:56 PM