我有一个我为https配置的WCF应用程序。但是我收到以下错误: mscorlib.dll中出现“System.Security.SecurityException”类型的异常,但未在用户代码中处理
Exception Details: System.ServiceModel.Security.SecurityAccessDeniedException: Access is denied.
Additional information: Request for principal permission failed.
我可以通过浏览器访问WCF服务,但是当我的客户端应用程序调用此服务时,我收到上述错误。
这是我的WCF服务:
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
public class SampleService
{
[PrincipalPermission(SecurityAction.Demand, Role = "Admin Users")]
public object PerformOperation(List<string> parameterList)
{
…..
…..
}
}
这是我的服务配置:
<serviceBehaviors>
<behavior name="Https.Service">
<serviceThrottling maxConcurrentCalls="100" maxConcurrentInstances="100" maxConcurrentSessions="100"/>
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
<serviceAuthorization principalPermissionMode="None"/>
</behavior>
</serviceBehaviors>
<service behaviorConfiguration="Https.Service" name="DBAccessService">
<endpoint address="https://SYSTEM_NAME.domain.com:444/App.Service/DBAccess.svc" binding="wsHttpBinding" contract="App.DBAccessService.IDBAccess" bindingConfiguration="TransportSecurity">
</endpoint>
</service>
客户端配置:
<client>
<endpoint address="https://SYSTEM_NAME.domain.com:444/App.Service/DBAccess.svc" binding="wsHttpBinding" contract="App.DBAccessService.IDBAccess" >
<identity>
<servicePrincipalName value="host/localhost"/>
</identity>
</client>
我使用的是自签名证书,我存储在“受信任的根证书”文件夹中。
我尝试了一些事情:
我已经通过'几个StackVoerflow帖子并尝试了很多组合,但没有运气。