WCF 托管在 IIS6 上
Posted
技术标签:
【中文标题】WCF 托管在 IIS6 上【英文标题】:WCF Hosted on IIS6 【发布时间】:2011-07-22 20:53:31 【问题描述】:我试图阻止允许匿名访问我的 WCF 服务,但是我不断收到错误消息“此服务的安全设置需要‘匿名’身份验证,但托管此服务的 IIS 应用程序未启用它。”
我尝试了各种想法,例如删除 mex 端点并将安全模式设置为仅传输凭据,但这不起作用。
配置:
我的应用程序池身份配置为位于我的域中的网络帐户, 我的网站未勾选匿名访问并勾选了集成 Windows 身份验证。 我的服务配置是:
<services>
<service behaviorConfiguration="CRMDataDashboard_Service.CoreServiceBehavior"
name="CRMDataDashboard_Service.CoreService">
<endpoint address="http://crmb1:8900/CoreService.svc" binding="basicHttpBinding" contract="CRMDataDashboard_Service.ICoreService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="CRMDataDashboard_Service.Service1Behavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
<behavior name="CRMDataDashboard_Service.ChartDataBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
<behavior name="CRMDataDashboard_Service.DataDashboardServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
<behavior name="CRMDataDashboard_Service.CoreServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
对此的任何帮助将不胜感激
【问题讨论】:
【参考方案1】:你在使用 basicHttpBinding 吗?
这个答案可能会有所帮助: IIS hosted WCF-service + Windows auth in IIS + TransportCredentialOnly/Windows auth in basicHttpBinding
【讨论】:
还有***.com/questions/5150612/… 试过这些和我的设置都一样。【参考方案2】:您需要在配置中创建一个绑定,将 Windows 身份验证定义为传输安全:
<bindings>
<basicHttpBinding>
<binding name="BasicHttpEndpointBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
</bindings>
看看here。
更新
你需要把上面的代码放在<system.serviceModel>
下面。您还需要指向配置中的绑定(在bindingConfiguration
中使用BasicHttpEndpointBinding
,因为这是我们定义的绑定):
<endpoint address="http://crmb1:8900/CoreService.svc" binding="basicHttpBinding" contract="CRMDataDashboard_Service.ICoreService" bindingConfiguration="BasicHttpEndpointBinding">
<identity>
【讨论】:
配置中的哪个位置? 我有它,但它仍然传递同样的错误。 - 配置中还有什么我需要的,即集成安全 = True 等。 把你的新绑定放在这里。并阅读我发送的链接,确保您已完成所有操作。 检查了链接 - 这是我的绑定以上是关于WCF 托管在 IIS6 上的主要内容,如果未能解决你的问题,请参考以下文章
无法将 Azure VM 上托管的 WCF 服务引用添加到 VS2015 项目
在 Azure 应用服务上托管 WCF 不响应客户端应用服务
访问本地 IIS 上托管的 WCF 服务时出错:“相对 URI 不支持此操作。”