InitializePropertiesFromConfiguration(String serviceName) NullReferenceException

风格不统一 提交于 2019-12-31 05:24:09

问题


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

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