私はよく分からない理由が、私のFederatedAuthentication.SessionAuthenticationModule)はNULLとして解決し、私は(私のClaimsTransformerを実行しようとすると、私のアプリをクラッシュされたモジュール:FederatedAuthentication.SessionAuthenticationModuleをNULLに戻す理由を教えてください。
public void EstablishSession(ClaimsPrincipal principal)
{
var sessionToken = new SessionSecurityToken(principal, TimeSpan.FromHours(8))
{
IsPersistent = false, // make persistent
IsReferenceMode = true // cache on server
};
FederatedAuthentication.SessionAuthenticationModule.WriteSessionTokenToCookie(sessionToken);
// FederatedAuthentication.SessionAuthenticationModule == null and I throw an error :(
}
ここに私のweb.configファイルには何があります:
<configSections>
<section name="system.identityModel" type="System.IdentityModel.Configuration.SystemIdentityModelSection, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<section name="system.identityModel.services" type="System.IdentityModel.Services.Configuration.SystemIdentityModelServicesSection, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
</configSections>
<system.web>
<authentication mode="None" />
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="RoleManager" />
<remove name="FormsAuthentication" />
<remove name="SessionAuthenticationModule" />
<add name="SessionAuthenticationModule" type="System.IdentityModel.Services.SessionAuthenticationModule, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</modules>
</system.webServer>
<system.identityModel>
<identityConfiguration>
<claimsAuthenticationManager type="Web.Infrastructure.Authentication.ClaimsTransformer, Web" />
</identityConfiguration>
</system.identityModel>
<system.identityModel.services>
<federationConfiguration>
<cookieHandler requireSsl="false" />
</federationConfiguration>
</system.identityModel.services>
私は、(概念実証)プロジェクトで問題なくコードを実行しているので、私は夢中です。この機能を動作させるために必要なものはすべて表示されていますが、実際のプロジェクトでは、FederatedAuthentication.SessionAuthenticationModuleは常にNULLです。
私はここで何が欠けていますか?何か案は? SessionAuthenticationModuleが正しく初期化されないのはなぜですか?
次の3つを追加SessionAuthenticationModuleを追加する前にノード 'を削除し' なぜ? –
設定が.configチェーンのどこかに追加されている場合。削除してから私が前に見たことがあり、私のコードが機能していなかったので、私はすべてを試していた... – user1265146