Connect As > Specified Use" />
开发者

Is there a way to run a WCF webservice as a different user without creating a new application pool for it

I have a WCF/.NET4 Web Service. With my regular .NET web apps (mostly MVC2), I can specify impe开发者_高级运维rsonation for another AD account by going to "Basic Settings > Connect As > Specified User" in the IIS7 control panel. However when I set this for a a WCF service, the service will still run as the IIS user. I know the impersonation is working because I can dump a regular aspx page in the same application folder that just spits out the ID of the impersonated user.

The only way I've found to have WCF services run as a different user is to create a new application pool just for that user and assign it to my application. Is there a way to use the existing pool and IIS impersonation like with regular .NET apps? I really don't want to have to create a new app pool for each new .NET service that needs different access rights.


Although the WCF model is designed to behave consistently across hosting environments and transports, there are often scenarios where an application does not require this degree of flexibility. WCF’s ASP.NET compatibility mode is suitable for scenarios that do not require the ability to host outside of IIS or to communicate over protocols other than HTTP, but that use all of features of the ASP.NET Web application platform.

WCF’s ASP.NET compatibility mode is enabled at the application level through the following configuration (located in the application’s Web.config file):

<system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>

You can try if this meets your needs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜