[英]WCF Active Directory Authorization - PrincipalPermission -> access denied
我嘗試通過基於AD的登錄系統保護WCF服務。 我創建了一個名為“ TestUsers”的AD組。 我的用戶帳戶是該組的成員。 WCF服務托管在IIS中。
但是我總是得到異常“ SecurityAccessDeniedException”。
我的WCF服務看起來像:
Web.Config中
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpEndpointBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
IService1.cs(服務接口):僅一種方法:
string GetWelcomeMessage();
Service1.svc.cs:
public class Service1 : IService1
{
[PrincipalPermission(SecurityAction.Demand, Role = @"mydomain\TestUsers")]
public string GetWelcomeMessage()
{
return "hello world";
}
}
任何想法有什么問題嗎???
任何幫助將不勝感激。
確保允許運行承載IIS的服務的帳戶在AD中執行安全檢查。
也改變
includeExceptionDetailInFaults="false"
至
includeExceptionDetailInFaults="true"
目前,這可能有助於您分析問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.