2012-01-03 12 views
0

私はちょうど以下の指示に従いましたhereAzure ACS with HTTPS and multiple instancesエラー

そして、いくつかのブログエントリherehereがかなり役に立ちました。

しかし、私はまだASP.NET MVC3アプリケーションをAzure上でHTTPSエンドポイントで実行していると奇妙な問題が発生しています。私はHTTPS証明書を読み込んでおり、何の問題もなく1つのロールインスタンスに一貫して展開しています。しかし、ちょうど最近、私は複数のインスタンスを展開し始め、「指定された状態で使用するには無効なキー」と「値はnullにはできません。パラメータ名:証明書のエラー。

しかし、私は今、新しいものを持っている:「ストリームの終わりを超えて読み取ることができません」

かなりバニラに見えます。 DPAPIからRSAクッキーへの移行に関する問題は、スタックトレースを見るまで変わらないことは明らかです。

[EndOfStreamException:ストリームの終わりを超えて読み取ることができません。] System.IO.MemoryStream.InternalReadInt32()12750266 Microsoft.IdentityModel.Web.RsaEncryptionCookieTransform.Decode(バイト[]は符号化された)369 Microsoft.IdentityModel.Tokens.SessionSecurityTokenHandler.ApplyTransforms(バイト[]クッキー、ブールアウトバウンド)189 Microsoft.IdentityModel.Tokens.SessionSecurityTokenHandler.ReadToken(XmlReaderのリーダー、SecurityTokenResolver tokenResolver)862 Microsoft.IdentityModel.Tokens.SessionSecurityTokenHandler.ReadToken (Byte [] token、SecurityTokenResolver tokenResolver)+109 Microsoft.IdentityModel.Web.SessionAuthentication Module.ReadSessionTokenFromCookie(バイト[] sessionCookie)+356 Microsoft.IdentityModel.Web.SessionAuthenticationModule.TryReadSessionTokenFromCookie(SessionSecurityToken &はsessionToken)123 Microsoft.IdentityModel.Web.SessionAuthenticationModule.OnAuthenticateRequest(オブジェクト送信者、のEventArgsのEventArgs)を+61 システム。 Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()80 System.Web.HttpApplication.ExecuteStep(IExecutionStepステップ、ブール& completedSynchronously)270

私は、グローバルに次のコードを追加しています。 asax:

void OnServiceConfigurationCreated(object sender, ServiceConfigurationCreatedEventArgs e) 
    { 
     // 
     // Use the <serviceCertificate> to protect the cookies that are sent to the client. 
     // 
     List<CookieTransform> sessionTransforms = new List<CookieTransform>(
      new CookieTransform[] { 
       new DeflateCookieTransform(), 
       new RsaEncryptionCookieTransform(e.ServiceConfiguration.ServiceCertificate) }); 
     SessionSecurityTokenHandler sessionHandler = new SessionSecurityTokenHandler(sessionTransforms.AsReadOnly()); 
     e.ServiceConfiguration.SecurityTokenHandlers.AddOrReplace(sessionHandler); 
    } 

と同様に、このコード:

void WSFederationAuthenticationModule_RedirectingToIdentityProvider(object sender, RedirectingToIdentityProviderEventArgs e) 
    { 
     // In the Windows Azure environment, build a wreply parameter for the SignIn request 
     // that reflects the real address of the application. 
     HttpRequest request = HttpContext.Current.Request; 
     Uri requestUrl = request.Url; 
     StringBuilder wreply = new StringBuilder(); 
     wreply.Append(requestUrl.Scheme); // e.g. "http" or "https" 
     wreply.Append("://"); 
     wreply.Append(request.Headers["Host"] ?? requestUrl.Authority); 
     wreply.Append(request.ApplicationPath); 
     if (!request.ApplicationPath.EndsWith("/")) wreply.Append("/"); e.SignInRequestMessage.Reply = wreply.ToString(); 
    } 
+0

この問題も発生しています。非常にイライラしています。解決策を見つけた場合は、教えてください! –

答えて

0

私は最近、同様の問題に取り組んだと潜在的な理由は、古いSDKとACSの組み合わせでした。 SDK 1.6とACSv2の設定を試してみると、この問題は起こらないと思っていますが、それでも問題が見える場合は、根本的な原因を見つけることができてうれしいです。

関連する問題