0
votes

I have a Cloud Service running over SSL on Azure; I can browse to the service and get its wsdl over SSL but when I do the soap address location is returned incorrectly - instead of using the domain name bound to the certificate I get the server name

< soap:address location="http:// rd00155d45cc3c/Amazon.svc"/>

I am expecting to see

< soap:address location="https://azure.mydomain.com/Amazon.svc"/>

My config

<system.serviceModel>
    <bindings>
        <basicHttpBinding>                
            <binding name="AzureBinding">
                <security mode="Transport" />
            </binding>
        </basicHttpBinding>
    </bindings>
    <services>
        <service name="MyService">
            <endpoint address="" binding="basicHttpBinding" 
                      contract="StudentServiceWCF.IAmazon" 
                      bindingConfiguration="AzureBinding" />
            <endpoint address="mex" binding="mexHttpsBinding" 
                      contract="IMetadataExchange" />
        </service>
    </services>
    <behaviors>
        <serviceBehaviors>
            <behavior>
               <serviceMetadata httpsGetEnabled="true" />
                <serviceDebug includeExceptionDetailInFaults="true"/>
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>

My app.config client endpoint is configured

<endpoint address="https://azure.mydomain.com/Amazon.svc"
          binding="basicHttpBinding" 
          bindingConfiguration="BasicHttpBinding_IOutOfDateSecure"
          contract="AzureService.IAmazon" name="BasicHttpBinding_IAmazon" />

<binding name="BasicHttpBinding_IAmazon">
    <security mode="Transport" />
</binding>

I don't know how to affect the address location so it uses the domain name from my certificate. Because it's returning the http location the test client is throwing an exception:

The HTTP service located at http:// rd00155d45cc3c/Amazon.svc is unavailable

2
have you installed this hotfix, also do you use the UseRequestHeadersForMetadataAddress ? - astaykov
Where would I install that hotfix, on my local development box? There's a concerning message on it > Please be aware this Hotfix has not gone through full Microsoft product regression testing nor has it been tested in combination with other Hotfixes. - Simon Martin

2 Answers

1
votes

So, a bit oldish in the comment, but check this article.

step 6 describes what behavior to add (UseRequestHeadersForMeatadataAddress) and when was it introduced: KB981002- WCF: Hotfix rollup upodate. This shall solve your issues.

And the KB981001 is an official hotfix / update for Windows. It must be installed on both - your dev machine, and the Windows Azure Instances where you deploy your service. However, if you are not explicitly targeting an old Guest OS (specific osVersion), that hotfix must be already installed.

1
votes

useRequestHeadersForMetadataAddress as suggested by @astaykov got me some of the way to the solution however in order to be able to get the wsdl over https I needed to add

<protocolMapping>
    <add scheme="https" 
         binding="basicHttpBinding" 
         bindingConfiguration="BasicHttpBinding_IService1" />
</protocolMapping>

to the system.serviceModel section in my configuration and this gives me the correct result in my soap:address location element in the generated wsdl from Azure.

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="AzureBinding">
                <security mode="Transport">
                    <transport clientCredentialType="None" />
                </security>
            </binding>                
        </basicHttpBinding>
    </bindings>
    <services>
        <service name="MyService">
            <endpoint address="" binding="basicHttpBinding" 
                      contract="StudentServiceWCF.IAmazon" 
                      bindingConfiguration="AzureBinding" />
            <endpoint address="mex" binding="mexHttpsBinding" 
                      contract="IMetadataExchange" />
        </service>
    </services>
    <behaviors>
        <serviceBehaviors>
            <behavior>
                <serviceMetadata httpsGetEnabled="true" />
                <serviceDebug includeExceptionDetailInFaults="true"/>
                <useRequestHeadersForMetadataAddress>
                    <defaultPorts>
                        <add scheme="https" port="443" />
                    </defaultPorts>
                </useRequestHeadersForMetadataAddress>
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    <protocolMapping>
        <add scheme="https" binding="basicHttpBinding" 
             bindingConfiguration="BasicHttpBinding_IService1" />
    </protocolMapping>
</system.serviceModel>