是否可以配置自定义DataService <t>以允许模拟?</t>

时间:2012-07-27 16:31:20

标签: wcf wcf-data-services odata impersonation

在“标准”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'以允许模拟?

1 个答案:

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