将凭证从一个wcf服务传递到另一个wcf服务

gho*_*ost 5 impersonation wcf-security

我在同一台机器上的IIS上托管了2个wcf服务.服务A由客户端调用,并使用BasicHttpBinding传输安全性和NTLM credentialtype.服务A需要调用服务B,服务B也托管在IIS上,但使用WsHttpBinding传输安全性和NTLM credentialtype.

IIS配置为使用集成的Windows身份验证.

我第一次尝试403禁止消息:

System.ServiceModel.Security.MessageSecurityException : The HTTP request was forbidden with client authentication scheme 'Ntlm'.
System.Net.WebException: The remote server returned an error: (403) Forbidden.
Run Code Online (Sandbox Code Playgroud)

这是正常的,因为当我从服务A拨打到服务B时,​​会使用应用程序池的标识.

在我的第二次尝试中,我尝试模拟对服务B的调用,但问题是操作中的所有代码都在调用者帐户下执行.此帐户在服务器上没有ACL权限,并且不提供这些权限.记录以下错误:

System.IO.FileLoadException : Could not load file or assembly 'System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The handle is invalid. (Exception from HRESULT: 0x80070006 (E_HANDLE))
Run Code Online (Sandbox Code Playgroud)

如何在不改变ACL或应用程序池标识的安全性的情况下解决这个问题?