简体   繁体   中英

WCF service not impersonating specified user in config?

I have a basic WCF service using basicHttpBinding. I have my site project and my services project. In my site project, I have a regular Services Reference to a service in my services project. In my development environment, it works fine. However, in our staging environment, we have enabled impersonation on the services application. This service connects to a SQL database using this user, of course.

The issue is, while the other ASMX services seem to impersonate just fine with the user defined in the web.config, the WCF service is still running as the site's user, causing SQL authentication to fail.

Are there extra steps to enable impersonation for my WCF service? I have not done anything special beside adding:

service.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Delegation;

After I initialize my service proxy from my website. Thoughts? Thanks.

If you mean ASP.NET impersonation account configured in web.config it doesn't work with WCF unless you turn on AspNetCompatibility . WCF doesn't offer any such configuration.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM