gpt4 book ai didi

wcf - IIS 托管 WCF 服务 + Windows 身份验证在 IIS + TransportCredentialOnly/Windows 身份验证在 basicHttpBinding

转载 作者:行者123 更新时间:2023-12-03 11:57:39 26 4
gpt4 key购买 nike

我想创建一个托管在 IIS6 中的 WCF 服务并在 IIS 中禁用匿名身份验证。并且不要使用 SSL。

所以我唯一的方法是使用 basicHttpBinging 和 TransportCredentialOnly ,不是吗?

我创建一个虚拟目录,设置 Windows 集成身份验证并取消选中“启用匿名访问”。

这是我的 web.config:

<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="MyBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="Samples.ServiceFacadeService" behaviorConfiguration="ServiceFacadeServiceBehavior">
<endpoint address="" binding="basicHttpBinding" bindingName="MyBinding"
contract="Samples.IServiceFacadeService">
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceFacadeServiceBehavior">
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>

您可以看到我什至没有包含用于元数据交换的 MEX-enpoint。只有一个端点和一个具有 TransportCredentialOnly 安全性的绑定(bind)。

但是当我尝试启动服务(通过客户端代理调用方法)时,我在 EventLog 中遇到了这样的异常:

Exception: System.ServiceModel.ServiceActivationException: The service '/wcftest/ServiceFacadeService.svc' cannot be activated due to an exception during compilation. The exception message is: Security settings for this service require 'Anonymous' Authentication but it is not enabled for the IIS application that hosts this service.. ---> System.NotSupportedException: Security settings for this service require 'Anonymous' Authentication but it is not enabled for the IIS application that hosts this service.



我不知道为什么我的服务需要匿名身份验证?为什么?

最佳答案

答案找到了jezell。谢谢。
我混淆了 bindingName 和 bindingConfiguration :

<endpoint address="" binding="basicHttpBinding" bindingName="MyBinding"
contract="Samples.IServiceFacadeService">
</endpoint>

这是正确的:
<endpoint address="" binding="basicHttpBinding" **bindingConfiguration**="MyBinding"
contract="Samples.IServiceFacadeService">
</endpoint>

关于wcf - IIS 托管 WCF 服务 + Windows 身份验证在 IIS + TransportCredentialOnly/Windows 身份验证在 basicHttpBinding,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/219151/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com