【问题标题】:ACS azure for published applicationACS azure 用于已发布的应用程序
【发布时间】:2013-06-04 22:32:09
【问题描述】:

大家好, 我使用 VS 2012 开发了一个 WebForms 应用程序。我已经在 Azure 上发布了它。 之后我集成了 ACS(我已将 URL 设置为我已经发布的应用程序) 我再次发布了应用程序,但它不起作用。 在我注册自己之后(例如使用 Yahoo 或 LiveID),我遇到了这个错误:

“/”应用程序中的服务器错误。

数据保护操作不成功。这可能是由于没有为当前线程的用户上下文加载用户配置文件造成的,这可能是线程模拟时的情况。

说明:在执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详细信息:System.Security.Cryptography.CryptographicException:数据保护操作不成功。这可能是由于没有为当前线程的用户上下文加载用户配置文件造成的,这可能是线程模拟时的情况。

来源错误:

在执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常来源和位置的信息。

堆栈跟踪:

[CryptographicException:数据保护操作不成功。这可能是由于没有为当前线程的用户上下文加载用户配置文件,这可能是线程模拟时的情况。] System.Security.Cryptography.ProtectedData.Protect(Byte[] userData, Byte[] optionalEntropy, DataProtectionScope 范围) +379 System.IdentityModel.ProtectedDataCookieTransform.Encode(Byte[] value) +52

[InvalidOperationException:ID1074:尝试使用 ProtectedData API 加密 cookie 时发生 CryptographicException(有关详细信息,请参阅内部异常)。如果您使用的是 IIS 7.5,这可能是由于应用程序池上的 loadUserProfile 设置设置为 false。 ] System.IdentityModel.ProtectedDataCookieTransform.Encode(Byte[] value) +167 System.IdentityModel.Tokens.SessionSecurityTokenHandler.ApplyTransforms(Byte[] cookie, Boolean outbound) +57 System.IdentityModel.Tokens.SessionSecurityTokenHandler.WriteToken(XmlWriter writer, SecurityToken token) +658 System.IdentityModel.Tokens.SessionSecurityTokenHandler.WriteToken(SessionSecurityToken sessionToken) +86 System.IdentityModel.Services.SessionAuthenticationModule.WriteSessionTokenToCookie(SessionSecurityToken sessionToken) +144 System.IdentityModel.Services.SessionAuthenticationModule.AuthenticateSessionSecurityToken(SessionSecurityToken sessionToken, Boolean writeCookie) +82 System.IdentityModel.Services.WSFederationAuthenticationModule.SetPrincipalAndWriteSessionToken(SessionSecurityToken sessionToken, Boolean isSession) +216 System.IdentityModel.Services.WSFederationAuthenticationModule.SignInWithResponseMessage(HttpRequestBase 请求) +860 System.IdentityModel.Services.WSFederationAuthenticationModule.OnAuthenticateRequest(对象发送者,EventArgs args)+369 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +136 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69

我该怎么办? 我已经正确设置了 URL。我在 web.config 中没有“localhost”的任何引用。 我不知道我必须另外设置什么才能使它起作用..

【问题讨论】:

    标签: azure visual-studio-2012 acs


    【解决方案1】:

    默认情况下,WIF 使用 DPAPI 来加密 cookie。切换到基于证书的加密。看到这个答案:

    Is it possible to run WIF without LoadUserProfile = True

    【讨论】:

    • 您好,我已在 global.asax 文件中输入了该答案的代码。但它仍然无法正常工作。我有 2 个问题: 警告 1 元素 'issuerNameRegistry' 的子元素 'authority' 无效。预期的可能元素列表:“trustedIssuers”。 F:\sii\WebApplication5\WebApplication5\Web.config 95 10 WebApplication5 错误 2 找不到类型或命名空间名称“FederationConfigurationCreatedEventArgs”(您是否缺少 using 指令或程序集引用?) F:\sii\WebApplication5\WebApplication5 \Global.asax.cs 19 62 WebApplication5 我该怎么办?
    【解决方案2】:

    Vittorio Bertocci 在这里回答了这个问题 http://www.cloudidentity.com/blog/2013/01/28/running-wif-based-apps-in-windows-azure-web-sites-4/

    DPAPI 在云网络应用中不可用,4.5 有一个简单的解决方案

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-01-24
      • 2019-01-16
      • 1970-01-01
      • 2011-05-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-18
      相关资源
      最近更新 更多