WCF service not impersonating specified user in config?

心已入冬 提交于 2020-01-16 05:15:08

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/5172840/wcf-service-not-impersonating-specified-user-in-config

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!