locked
Problem setting up a WCF web service on SSL server RRS feed

  • Question

  • User422354331 posted

    Hi All,

    I have been trying for 2 days to fix this problem, but I seem to be going around in circles.

    My web.config looks like this:

    <system.serviceModel>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    <services>
    <service name="Namespece.Service1">
    <endpoint address=""
    binding="basicHttpBinding"
    bindingConfiguration="secureHttpBinding"
    contract="Namespace.ServiceInterface"
    />
    <endpoint address="mex"
    binding="mexHttpsBinding"
    contract="IMetadataExchange" />
    </service>
    </services>
    <bindings>
    <basicHttpBinding>
    <binding name="secureHttpBinding">
    <security mode="Transport">
    <transport clientCredentialType="None"/>
    </security>
    </binding>
    </basicHttpBinding>
    </bindings>
    <behaviors>
    <serviceBehaviors>
    <behavior>
    <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
    <serviceMetadata httpsGetEnabled="true" httpsGetUrl="https://www.domain.org/virtualDirectory/Service1.svc" />
    <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
    <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
    </serviceBehaviors>
    </behaviors>
    </system.serviceModel>

    When I try and run the service I get the following error:

    When 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' is set to true in configuration, the endpoints are required to specify a relative address. If you are specifying a relative listen URI on the endpoint, then the address can be absolute. To fix this problem, specify a relative uri for endpoint 'https://www.domain.org/virtualDirectory/Service1.svc'.

    If I change the web.config to:

    <system.serviceModel>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    <services>
    <service name="Namespace.Service1">
    <endpoint address=""
    binding="basicHttpBinding"
    bindingConfiguration="secureHttpBinding"
    contract="Namespace.ServiceInterface" />
    <endpoint address="mex"
    binding="mexHttpsBinding"
    contract="IMetadataExchange" />
    <host>
    <baseAddresses>
    <add baseAddress="https://www.domain.org/"/>
    </baseAddresses>
    </host>
    </service>
    </services>
    <bindings>
    <basicHttpBinding>
    <binding name="secureHttpBinding">
    <security mode="Transport">
    <transport clientCredentialType="None"/>
    </security>
    </binding>
    </basicHttpBinding>
    </bindings>
    <behaviors>
    <serviceBehaviors>
    <behavior>
    <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
    <serviceMetadata httpsGetEnabled="true" httpsGetUrl="/VirtualDirectory/Service1.svc" />
    <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
    <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
    </serviceBehaviors>
    </behaviors>
    </system.serviceModel>

    I get the following error:

    The HttpsGetEnabled property of ServiceMetadataBehavior is set to true and the HttpsGetUrl property is a relative address, but there is no https base address.  Either supply an https base address or set HttpsGetUrl to an absolute address.

    This all works great on my local machine without any urls specified with SSL, but not on the server. I am actually beginning to think the server is the problem.
    Could it be the load balancing that is causing the problem? 

    I am now out of ideas on this one, can anyone help me please?

     

    Wednesday, March 20, 2013 6:55 AM

Answers

  • User422354331 posted

    Ok, solved it, the problem was the load balancer. I eventually had to set the httpsGetEnabled to false, as this is a service that is not intended for public use, it's not a problem. Even if it's not the most elegant way of doing it.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 21, 2013 5:19 AM

All replies

  • User422354331 posted

    Thanks for the suggestion Sukumarraju,

    I have gone through all the MS documentation (including the 2 sites you mention, unfortunately) and more, none of the solutions seem to work on the server I have released the webservice to.

    As I say in my original post, it all works great on my local machine with a self sign SSL certificate, this leads me to think the problem is with the server in some way and not my configuration.

    Wednesday, March 20, 2013 10:57 AM
  • User422354331 posted

    Ok, solved it, the problem was the load balancer. I eventually had to set the httpsGetEnabled to false, as this is a service that is not intended for public use, it's not a problem. Even if it's not the most elegant way of doing it.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 21, 2013 5:19 AM