我的 WCF 服务使用 HTTPS 运行,它显示信息页面,但“要测试此服务,...使用以下语法:”下面的 URL 是:
svcutil.exe https://servername.group.service.com/MyService.svc?wsdl
(服务器的完整地址)
而不是正确的 URL https://my.service.com/MyService.svc?wsdl (分配的主机头),我怎样才能让它显示正确的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>
我已经尝试更改 <serviceMetadata httpsGetEnabled="true"/>
进入<serviceMetadata httpsGetEnabled="true" httpsGetUrl="https://my.service.com/MyService.svc"/>
但它只是说:“URI https://my.service.com/MyService.svc 的注册已存在”
最佳答案
您指定已设置主机 header 。是设置为 SSL 还是只是 Http。请记住,IIS UI 没有为 SSL 设置主机 header 的字段。对于更高版本的 IIS,您需要使用管理脚本 (IIS 6.0) 或 netsh.exe。
关于.net - 使用 WCF (https) 时 WSDL 超链接中的 URL 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3750945/