c# – 如何在WCF服务wsdl链接中将域名替换为域名
作者:互联网
不确定该问题的名称,但问题如下:
我在IIS 6上部署WCF服务,该服务将由外部源使用.
它所在的盒子是外部托管的,但有一个DC,因此在我的网络上有效(‘mydomain’),在内部称为’prod’.
该服务需要通过SSL运行,因此我们获得了服务将响应的域的SSL证书:service.oursite.com
DNS已全部通过,我确实可以点击该服务
https://service.oursite.com/service.svc
它开始了小svcutil链接.
问题是链接指向的地址不是
我希望https://service.oursite.com/service.svc?wsdl
相反
https://prod.mydomain.com/service.svc?wsdl
所以当然SSL保释金,因为证书不适用于此
如果我点击wsdl所有schemaLocation链接都是错误的,再次指向内部名称而不是外部名称
问题是:
它为什么这样做?
和
我该怎么做呢?
这是在配置中添加内容的问题吗? (请说是:))
最感激的任何帮助
如果它有帮助这里是配置
<services>
<service name="CBBookingService.CBBookingService" behaviorConfiguration="CBBookingService.CBBookingServiceBehavior">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="TransportSecurity" contract="CBBookingService.ICBBookingService" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="BasicSecurity" maxReceivedMessageSize="2147483647">
<security mode="None" />
</binding>
<binding name="TransportSecurity" maxReceivedMessageSize="2147483647">
<!--https-->
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="CBBookingService.CBBookingServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
解决方法:
您可以使用< useRequestHeadersForMetadataAddress>服务行为,你应该得到你想要的行为:
<behaviors>
<serviceBehaviors>
<behavior name="CBBookingService.CBBookingServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<useRequestHeadersForMetadataAddress />
</behavior>
</serviceBehaviors>
</behaviors>
标签:c,net,wcf,iis-6 来源: https://codeday.me/bug/20190714/1460898.html