[英]How to use hosted application pool identity
I have a WCF RESTful service, it is hosted on IIS 7. I am using webHttpBinding binding with the WCF service. 我有一个WCF RESTful服务,该服务托管在IIS 7上。我正在将webHttpBinding与WCF服务一起使用。
This service is having a application pool for which I specified a custom account identity(I specified user name & password) 该服务有一个应用程序池,我为其指定了自定义帐户标识(我指定了用户名和密码)
Anonymous access is enabled for the WCF service. 为WCF服务启用了匿名访问。
From inside the WCF service code I want to make a HttpWebRequest to another server. 从WCF服务代码内部,我想向另一个服务器发出HttpWebRequest。 But I want to use the same context (identity) under which my application pool is running.
但是我想使用运行我的应用程序池的相同上下文(身份)。
How can I achieve it, do I need to use impersonation for this? 我如何实现它,我需要为此使用模拟吗? or is there any better way for it.
还是有更好的方法
Annu 安努
只需将HttpWebRequest
的UseDefaultCredentials
属性设置为true
。
Depends on if the other service supports Windows Authentication. 取决于其他服务是否支持Windows身份验证。 If it does then you can either
如果可以,那么您可以
request.UseDefaultCredentials = true;
or 要么
request.Credentials = CredentialCache.DefaultNetworkCredentials;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.