6

I got my WCF Service running with HTTPS, It shows the Infopage, but the URL below "To test this service, ... with the following syntax:" is:

svcutil.exe https://servername.group.service.com/MyService.svc?wsdl (full address of the server)

Instead of the correct URL https://my.service.com/MyService.svc?wsdl (assigned hostheader), how can I get it to show the right URL (<URL of the Service> + ?wsdl)?

<services>
  <service name="MyService" behaviorConfiguration="MyServer.MyServiceBehavior">
    <endpoint binding="basicHttpBinding" bindingConfiguration="basicHttpBigStrings" contract="IMyService">
    </endpoint>
    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="MyService.MyServiceBehavior">
      <serviceCredentials>
        <serviceCertificate findValue="my.service.com" x509FindType="FindBySubjectName"/>
      </serviceCredentials>
      <serviceMetadata httpsGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<bindings>
  <basicHttpBinding>
    <binding name="basicHttpBigStrings">
      <security mode="Transport">
        <transport clientCredentialType="None"/>
      </security>
      <readerQuotas maxStringContentLength="1048576" />
    </binding>
  </basicHttpBinding>
</bindings>

I already tried to change <serviceMetadata httpsGetEnabled="true"/> into <serviceMetadata httpsGetEnabled="true" httpsGetUrl="https://my.service.com/MyService.svc"/> but it just says: "A registration already exists for URI https://my.service.com/MyService.svc"

Hinek
  • 9,519
  • 12
  • 52
  • 74

2 Answers2

4

You specified that you've set Host Header. Is it set for SSL or just Http. Remember, IIS UI doesn't have fields to set Host-header for SSL. you'd need to use admin scripts (IIS 6.0) or netsh.exe for later version of IIS.

amit
  • 2,093
  • 16
  • 10
  • 1
    Host Header is only set for Http, do you have links for setting the Host Header for SSL? – Hinek Nov 29 '10 at 16:00
  • 1
    How is this a solution to the problem? –  Feb 27 '12 at 18:52
  • Amit - thank you!! After hours and hours of searching for solutions, this did the trick. We had removed host headers for both http and https to accommodate our load balancer configuration. Adding them back in fixed the problem. By the way, we were also seeing a blank page with a 400 bad request error when trying to request the WSDL over HTTPS (for anyone experiencing the same issue). – Adam May 11 '12 at 15:06
0

You can find some background on this at the following StackOverflow link - the first thing I would try (they give several different scenarios that are a little more involved) would be to set the Listen URI on the Service Endpoint definition. When I had problems getting the WSDL address right in my app I was able to set that to correct it. In that case I was simply trying to fix the scheme (we were behind a BIGIP and it was terminating SSL so the scheme needed to be https even though WCF on the server side thought it was getting http).

<endpoint address="https://www.sslloadbalancer.com" binding="someBinding" contract="IMyServiceInterface" listenUri="http://www.servicehost.com" ...  />

I believe that will fix the WSDL for you

Community
  • 1
  • 1
HintonBR
  • 76
  • 1
  • 6
  • The service is hosted in IIS, so IIS determines the URL, I can't set the endpoint address manually in the config. – Turrau Nov 23 '10 at 10:01
  • My example is from IIS hosted services - you know where on IIS you are deploying your service so why can't you set the endpoint address in the config? – HintonBR Dec 22 '10 at 13:44