在“标准”WCF服务上,我只需用以下方法标记操作方法:
[OperationBehavior(Impersonation = ImpersonationOption.Allowed)]
但是使用我的数据服务,只要打开DataServiceHost,我就会收到InvalidOperationException:
The service operation 'ProcessRequestForMessage' that belongs to the contract with the 'IRequestHandler' name and the 'http://tempuri.org/' namespace does not allow impersonation.
如何标记'ProcessRequestForMessage'以允许模拟?
答案 0 :(得分:0)
配置以下行为:
<behavior>
<serviceCredentials useIdentityConfiguration="true" />
<serviceAuthorization principalPermissionMode="Always" impersonateOnSerializingReply="true" />
</behavior>
另见WCF Data Service with WIF 4.5; Principal not set for POST requests