开发者

What do you Need for Windows Authentication Pass through on an MVC website and WCF

开发者 https://www.devze.com 2023-03-28 08:32 出处:网络
Ok.I have an MVC2 application that accesses a WCF program, and uses that information to populate its model and so forth.I am unsure of everything I need to get this through?I have Impersonation code i

Ok. I have an MVC2 application that accesses a WCF program, and uses that information to populate its model and so forth. I am unsure of everything I need to get this through? I have Impersonation code in my client application (MVC2开发者_开发技巧 application) and in my Server application (WCF service). On my IIS 7 setup (on windows server 2008) I have Anonymous Authentication disabled, ASP.net impersonation Enabled, and Windows Authentication enabled. I have my process model pool identity set to ApplicationPoolIdentity. I thought that should probably do it. However, I keep getting errors telling me that the user ID is not going through. I guess, I want to know is what would you need to get that sort of application to work?


For your MVC App make sure your web config contains the following

<authentication mode="Windows" />
    <authorization>
    <deny users="?" />
</authorization>

Also note that IIS has authentication options on each tree node for websites, so for instance if you use the Default Web Site and have your app under this node the authentication options can differ between the top node and the node for your site. For my site I have all auth methods turned off for the default web site node and then I use windows authentication only on the app level node. Make sure anonymous is turned off on all nodes or httpcontext.current.user object will be null and in our case caused our app to crash.

Switching authentication modes does inherit so be careful when adjusting parent nodes because you may accidentally change the settings of child nodes.

0

精彩评论

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