【发布时间】:2011-04-14 15:17:07
【问题描述】:
我的 WCF 服务使用 HTTPS 运行,它显示信息页,但“要测试此服务,...使用以下语法:”下面的 URL 是:
svcutil.exe https://servername.group.service.com/MyService.svc?wsdl(服务器的完整地址)
我怎样才能让它显示正确的 URL (<URL of the Service> + ?wsdl),而不是正确的 URL https://my.service.com/MyService.svc?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 的注册已经存在”
【问题讨论】:
-
我也有同样的问题。你找到解决方案了吗?
-
不,到目前为止还没有,抱歉...
-
您是否在 IIS 中托管此服务?如果是这样,则 IIS 确定该 URL,而不是 WCF。
-
我将它托管在 IIS 中,是的!来自 IIS 的 URL 是正确的,但是 WCF 生成并呈现在可读页面中的链接是错误的。