无法让 WCF Web 服务与 Windows 身份验证一起使用
我已经编写了我的第一个 WCF Web 服务,它在我自己的本地测试 Web 服务器上运行良好,但是当我将其部署到 IIS 时遇到错误。
我们的 IIS 服务器使用集成身份验证,并且不允许允许匿名访问。来自我读过的内容,我需要将绑定的安全模式设置为 TransportCredentialOnly
。 web.config
中的整个部分是:
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="VZW.TrainingPortfolioManager.Website.TPMAspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
<service name="VZW.TrainingPortfolioManager.Website.TPM">
<endpoint address="" behaviorConfiguration="VZW.TrainingPortfolioManager.Website.TPMAspNetAjaxBehavior"
binding="webHttpBinding" contract="VZW.TrainingPortfolioManager.Website.TPM" />
</service>
</services>
<bindings>
<basicHttpBinding>
<binding>
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
但是,当我在浏览器中加载 Web 服务时,我收到错误消息:
Security settings for this service require 'Anonymous' Authentication but it is not enabled for the IIS application that hosts this service.
我还需要更改或配置其他内容才能使其正常工作吗?
I've written my first WCF web service, which works great on my own local test webserver, however I'm getting an error when I deploy it to IIS.
Our IIS server uses integrated auth, and does not allow anonymous access. From what I've read, I need to set the security mode on the binding to TransportCredentialOnly
. The entire section in web.config
is:
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="VZW.TrainingPortfolioManager.Website.TPMAspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
<service name="VZW.TrainingPortfolioManager.Website.TPM">
<endpoint address="" behaviorConfiguration="VZW.TrainingPortfolioManager.Website.TPMAspNetAjaxBehavior"
binding="webHttpBinding" contract="VZW.TrainingPortfolioManager.Website.TPM" />
</service>
</services>
<bindings>
<basicHttpBinding>
<binding>
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
However, when I load the web service in the browser, I get the error message:
Security settings for this service require 'Anonymous' Authentication but it is not enabled for the IIS application that hosts this service.
Is there anything else I need to change or configure to get this working?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
想通了。
endpoint
上的binding
属性必须与
集合中的节点匹配。以下将起作用:Figured it out. The
binding
attribute on theendpoint
has to match the node in the<bindings>
collection. The following will work: