Why would FederatedAuthentication.WSFederationAuthenticationModule be null in MVC Azure ACS Federated Authentication?

久未见 提交于 2019-12-01 07:04:08

I managed to fix this myself, and since there are a few unanswered questions similar to this on SO, I'll leave the question up and post my own answer.

The issue is to do with upgrading the MVC application to .NET 4.5. Much of the WIF functionality remains the same (at least on the surface), but the classes have all moved to different assemblies. I fixed my problem following the migration guidelines here: http://msdn.microsoft.com/en-us/library/jj157089.aspx

The most important thing is to remove old references to the Microsoft.IdentityModel package (v 3.5.0) and make sure they are replaced by similar references to the System.IdentityModel and System.IdentityModel.Services dlls, which should be version 4.0, and come from the GAC rather than an external package.

My steps to fix were:

  • Clean out all the junk I'd added to Web.Config and start again with a default MVC Config file.
  • Remove the Microsoft.IdentityModel package and de-reference the dll
  • Run the Access and Identity wizard in VS 2012
  • Duplicate the System.IdentityModel.Services.WSFederationAuthenticationModule reference from <system.webServer><modules> in <system.web><httpModules>
  • Add <authentication mode="Forms"><forms loginUrl="~/Account/LogOn" /></authentication>
  • Compile, test, dance little jig of delight...

And this got the original WIF3.5 / MVC3 Code Sample working under.NET 4.5

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