问题
I have configured 'SessionAuthenticationModule' based on the instructions from http://www.wiktorzychla.com/2014/11/forms-authentication-revisited-for-net.html. My application is in .Net 3.5 so I changed the library mappings based on "Namespace Mapping between WIF 3.5 and WIF 4.5". When I run it, it is throwing the exception shown below. "
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
Microsoft.IdentityModel.Web.SessionAuthenticationModule.InitializePropertiesFromConfiguration(String serviceName) +16
Microsoft.IdentityModel.Web.SessionAuthenticationModule.InitializeModule(HttpApplication context) +124
Microsoft.IdentityModel.Web.HttpModuleBase.Init(HttpApplication context) +30
" Major configuration settings are shown below.
<section name="Microsoft.IdentityModel" type="Microsoft.IdentityModel.Configuration.SystemIdentityModelSection, Microsoft.IdentityModel"/>
<section name="Microsoft.IdentityModel.Protocols" type="Microsoft.IdentityModel.Web.Configuration.SystemIdentityModelServicesSection, Microsoft.IdentityModel.Protocols.WSFederation"/>
</configSections>
<Microsoft.IdentityModel></Microsoft.IdentityModel>
<Microsoft.IdentityModel.Protocols>
<federationConfiguration>
<cookieHandler requireSsl="false"/>
</federationConfiguration>
</Microsoft.IdentityModel.Protocols>
Anything wrong with my configurations? Please help me.
回答1:
You seem to lack the SAM in web.config
.
<httpModules>
<add name="SessionAuthenticationModule"
type="Microsoft.IdentityModel.Web.SessionAuthenticationModule, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</httpModules>
Take a look at my old tutorial that aims at .NET 3.5
http://www.wiktorzychla.com/2011/08/quest-for-customizing-adfs-sign-ing-web.html
来源:https://stackoverflow.com/questions/36701258/initializepropertiesfromconfigurationstring-servicename-nullreferenceexception