【问题标题】:Cannot get WCF web service working with Windows auth无法使 WCF Web 服务与 Windows 身份验证一起使用
【发布时间】:2012-02-25 03:21:32
【问题描述】:

我已经编写了我的第一个 WCF Web 服务,它在我自己的本地测试网络服务器上运行良好,但是当我将它部署到 IIS 时出现错误。

我们的 IIS 服务器使用集成身份验证,并且不允许 允许匿名访问。从what I've read,我需要将绑定的安全模式设置为TransportCredentialOnlyweb.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.

还有什么我需要更改或配置才能使其正常工作的吗?

【问题讨论】:

    标签: .net wcf iis


    【解决方案1】:

    想通了。 endpoint 上的 binding 属性必须与 &lt;bindings&gt; 集合中的节点匹配。以下将起作用:

    <bindings>
      <webHttpBinding>
        <binding>
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows" />
          </security>
        </binding>
      </webHttpBinding>      
    </bindings>
    

    【讨论】:

      猜你喜欢
      • 2011-09-10
      • 1970-01-01
      • 2013-08-26
      • 1970-01-01
      • 2013-02-22
      • 1970-01-01
      • 1970-01-01
      • 2012-04-18
      • 1970-01-01
      相关资源
      最近更新 更多