并不确定该问题的名称,但问题如下:
我正在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>
答案 0 :(得分:10)
您可以使用<useRequestHeadersForMetadataAddress>
服务行为,您应该获得所需的行为:
<behaviors>
<serviceBehaviors>
<behavior name="CBBookingService.CBBookingServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<useRequestHeadersForMetadataAddress />
</behavior>
</serviceBehaviors>
</behaviors>
答案 1 :(得分:2)
您可以在配置中更改它。
<serviceMetadata httpGetEnabled="true"
externalMetadataLocation="https://service.oursite.com/service.svc?wsdl"/>
或使用https://stackoverflow.com/a/14592767/2012977表示asp.net v4或更高版本。
答案 2 :(得分:1)
感谢您的回答 不幸的是我使用.net 3.5所以下面的答案不起作用 我最终做了这个
<system.serviceModel>
<services>
<service name="CBBookingService.CBBookingService" behaviorConfiguration="CBBookingService.CBBookingServiceBehavior">
<endpoint address="https://service.oursite.com/CBBookingService.svc" binding="basicHttpBinding" bindingConfiguration="TransportSecurity" contract="CBBookingService.ICBBookingService" name="SSL" />
<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 httpsGetEnabled="true" httpsGetUrl="https://service.oursite.com/CBBookingService.svc/SSL" />
<serviceDebug includeExceptionDetailInFaults="false"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true">
</serviceHostingEnvironment>
</system.serviceModel>