Windows身份验证 - 检查角色

时间:2015-12-01 12:44:55

标签: c# wcf

如果我有这个web.config,我可以看到所有WCF。但我的角色不同。为什么应用程序不检查我的角色?

    <authorization>
      <allow roles="COMPANY\Administrators2"/>
      <deny users="*"/>
    </authorization>

的Web.Config

<?xml version="1.0"?>
<configuration>
  <appSettings/>
  <connectionStrings/>
  <system.web>
    <compilation debug="false" targetFramework="4.0"/>
    <authentication mode="Windows"/>
    <authorization>
      <allow roles="COMPANY\Administrators2"/>
      <deny users="*"/>
    </authorization>
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
  </system.web>
  <system.web.extensions>
    <scripting>
      <webServices>
      </webServices>
    </scripting>
  </system.web.extensions>
  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="WindowsSecurity">
          <security mode="Transport">
            <transport clientCredentialType="Windows" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="WCFWindowsBasicHttpBinding.Service1Behavior" name="WCFWindowsBasicHttpBinding.Service1">
        <endpoint 
                  binding="wsHttpBinding"
                  bindingConfiguration="WindowsSecurity"
                  contract="WCFWindowsBasicHttpBinding.IService1" >
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="WCFWindowsBasicHttpBinding.Service1Behavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>

选择身份验证

enter image description here

IIS中的规则

enter image description here

1 个答案:

答案 0 :(得分:0)