ASP.NET -> WCF Service requires Windows authentication

别等时光非礼了梦想. 提交于 2019-12-06 08:35:36

It depends... (Note most of this is based on HTTP/IIS as the transport, could be different if using TCP or other bindings)

WCF itself can be setup to use Transport or Message security using the current running credentials.

If the WCF service (and anything it needs to talk with using the current credential) is on the same box as the ASP>NET front end you will probably be ok

...otherwise you could be heading for "Double Hop Authentication" trouble. Basically windows auth will get an "impersonation" identity on the webserver which is fine locally, but it does not have permission authenticate off of the web server. To do that you need a "delegation" identity.

The options that I am aware of for getting a delegation identity are Kerberos and Basic Authentication.

So if when you say "windows authentication" you really mean everyone (client and all servers) are on the same AD domain you might ok.

I have an ASP.NET site using Windows Authentication which needed to call a WCF service which has Anonymous and Windows Authentication enabled. The problem I had was to pass the Windows Credentials to the WCF service.

To do so I did the following

  1. In the Web.config of the site, I made sure my WCF bindings used windows authentication: security mode="TransportCredentialOnly"

    transport clientCredentialType="Windows"

  2. IN IIS, I created an App Pool using .Net 4 and Classic Managed Pipeline Mode

  3. In my website authentication settings

    Anonymous Auth - Disabled

    ASP.NET Impersonation - Enabled

    Windows Auth - Enabled

That is what worked for me.

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