我已经多次看到这个问题在这里和到处都是,但我无法理解它。
这是我想做的。我需要在 IIS 6 中托管一个 WCF 服务。我想要用户名/密码安全,我不希望这些未加密传递,所以我使用 HTTPS。我在我的 IIS 上本地工作,但是当我部署它时,我得到了匿名访问未启用错误。在我的本地 IIS 上启用了匿名访问,在已部署的服务器上未启用,我们不想启用它。问题明白了。解决方案对我来说并不明显....
如果我在 IE 中导航到页面,或者从 Visual Studio 添加服务引用,我在输入用户名/密码后收到此错误。所以这表明我的证书和 HTTPS 工作正常,用户名和密码正确。以下是 web.config 中的相关设置:
<services>
<service name="SecureWcfTestsApplication.Service1">
<endpoint address=""
binding="wsHttpBinding"
bindingConfiguration ="Binding2"
contract="SecureWcfTestsApplication.IService1" />
</service>
</services>
<bindings>
<basicHttpBinding>
</basicHttpBinding>
<wsHttpBinding>
<binding name="Binding2">
<security mode="TransportWithMessageCredential">
<message clientCredentialType="Windows" algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
</bindings>
我正在使用 wsHttpBinding,因为它不喜欢将 clientCredentialType 设置为 Windows 的 basicHttpBinding。话虽如此,我宁愿使用 basicHttp,但它希望将 UserName 作为 clientCredentialType,而且我不确定 UserName 和 Windows 安全性之间的区别。
最佳
雷
最佳答案
如果您没有使用 Windows 身份验证配置传输安全性,您得到的异常是正常的,http://msdn.microsoft.com/en-us/library/ms733089.aspx
<transport>
在这种情况下需要标记,尽管您已经有了 <message>
标记已定义。
关于windows - WCF 异常 : . ..此服务需要 'Anonymous' 身份验证,但未为托管此服务的 IIS 应用程序启用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9744807/