WCF在IIS6上托管

时间:2011-03-25 11:56:26

标签: wcf iis

我正在尝试阻止允许对我的WCF服务进行匿名访问,但是我不断收到错误消息“此服务的安全设置需要'匿名'身份验证,但未对承载此服务的IIS应用程序启用。”< / p>

我尝试了各种想法,例如删除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>

任何有关这方面的帮助将不胜感激

2 个答案:

答案 0 :(得分:0)

您使用的是basicHttpBinding吗?

这个答案可能有所帮助: IIS hosted WCF-service + Windows auth in IIS + TransportCredentialOnly/Windows auth in basicHttpBinding

答案 1 :(得分:0)

您需要在配置中创建一个绑定,将窗口身份验证定义为传输安全性:

<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>