Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wrong URL in WSDL hyperlink when using WCF (https)

Tags:

.net

https

wcf

mex

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"

like image 621
Hinek Avatar asked Sep 20 '10 11:09

Hinek


1 Answers

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.

like image 86
amit Avatar answered Oct 16 '22 22:10

amit