【发布时间】:2015-10-15 02:33:43
【问题描述】:
我继承了一个托管在 IIS 下的 WCF 项目。它是常规网站的一部分,即也有可供人类使用的页面。
站点在 IIS 中配置有以下 2 个绑定:
1:https://www.example.com/ 2:http://www.example.com:8080/
如果我访问http://www.example.com:8080/my-service.svc?wsdl,我会得到一个按预期返回的 WSDL 文件。
如果我访问 https://www.example.com/my-service.svc?wsdl,我会被告知我需要访问 http://www.example.com:8080/my-service.svc?wsdl 来创建客户端。
web.config中system.serviceModel下没有绑定部分。
我想知道的是,服务如何知道它与第二个 IIS 绑定而不是第一个绑定相关联。
system.ServiceModel 如下:
<system.serviceModel>
<extensions>
<behaviorExtensions>
<add name="FormsAuthBehavior" type="My-WCF.FormsAuthBehaviorExtensionElement, EcobuttonWebService" />
</behaviorExtensions>
</extensions>
<behaviors>
<serviceBehaviors>
<behavior name="FormsAuthenticated">
<!--To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment-->
<serviceMetadata httpGetEnabled="true" />
<!--To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information-->
<serviceDebug includeExceptionDetailInFaults="false" />
<!--Pre-authenticates client with server to generate FormsAuthentication cookie. Cookie is submitted with each WCF request.-->
<!--NB: set throwsSecurityExceptions="false" when updating service references in client apps.-->
<FormsAuthBehavior throwsSecurityExceptions="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
<services>
<service name="My-Service" behaviorConfiguration="FormsAuthenticated" />
</services>
</system.serviceModel>
【问题讨论】:
-
显示您的 web.config 以便我们了解您做错了什么或错过了什么必要的事情?
-
你能显示 web.config 吗?而且,在不公开 wsdl 的服务中,配置有以下行:
? -
好的,添加了system.ServiceModel部分。
标签: web-services wcf