【问题标题】:Windows Azure intermittent Identity error when parsing webconfig解析 webconfig 时出现 Windows Azure 间歇性身份错误
【发布时间】:2013-08-18 16:15:07
【问题描述】:

此问题在发布后似乎是随机发生的。 网站会正常工作然后砰,我在解析 webconfig 时收到此错误。我只是重新发布,它又可以正常工作了。发布时,我选中了该框以删除现有文件,因此周围不应该有垃圾。

这是一个使用 .net 4.5 和与 Yahoo! 集成的 Azure 访问控制服务 (ACS) 的 MVC4 项目。从 Yahoo 重定向回来时会发生此错误。这种方式每次都会发生,但我发现了一个帖子(当然现在我找不到了),其中存在 4.5.1 Identity and Access Visual Studio 集成的错误。我去了以前的版本,现在只是偶尔。

ID8030:无法解析“type”属性的值。
验证'<issuerNameRegistry type="System.IdentityModel.Tokens.ValidatingIssuerNameRegistry, System.IdentityModel.Tokens.ValidatingIssuerNameRegistry"><authority name="[my authority]"><keys><add thumbprint="[print]" /></keys><validIssuers><add name="[issuer]" /></validIssuers></authority></issuerNameRegistry>'元素的type属性是否正确。

在上面的错误信息中,我已经为这篇文章替换了括号 ([]) 中的项目。

这是堆栈跟踪:

[TypeLoadException: ID8030: The value of the 'type' property could not be parsed. *** element is correct.]
System.IdentityModel.Configuration.TypeResolveHelper.Resolve(ConfigurationElementInterceptor customTypeElement, Type customType) +602659
System.IdentityModel.Configuration.IdentityConfiguration.GetIssuerNameRegistry(IssuerNameRegistryElement element) +114
System.IdentityModel.Configuration.IdentityConfiguration.LoadHandlerConfiguration(IdentityConfigurationElement element) +841
System.IdentityModel.Configuration.IdentityConfiguration.LoadConfiguration(IdentityConfigurationElement element) +117
System.IdentityModel.Configuration.IdentityConfiguration..ctor(String identityConfigurationName) +180
System.IdentityModel.Services.Configuration.FederationConfiguration.LoadConfiguration(FederationConfigurationElement element) +392
System.IdentityModel.Services.Configuration.FederationConfiguration..ctor(Boolean loadConfig) +94
System.IdentityModel.Services.FederatedAuthentication.CreateFederationConfiguration() +71
System.IdentityModel.Services.FederatedAuthentication.get_FederationConfiguration() +85
System.IdentityModel.Services.HttpModuleBase.Init(HttpApplication context) +56
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +418
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): ***... element is correct.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9873784
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

【问题讨论】:

  • 这不完全是您问题的答案,但它可能对您有所帮助。您是否考虑过使用 Thinktecture 的身份模型包装器?我已经取得了很好的成功,它允许您以编程方式进行比核心 .net 代码更多的配置,这可能会让您摆脱配置问题。 Identity Model Nuget Package
  • 谢谢,我会试试看效果如何。看起来不错:)

标签: asp.net-mvc-4 azure web-config acs federated-identity


【解决方案1】:

我在本地运行时遇到了同样的问题。我正在浏览此处找到的操作方法:http://msdn.microsoft.com/en-us/library/jj161104.aspx,并且会在该程序集中得到类型未找到错误。

我仔细检查以确保我通过 NuGet 删除了程序集,甚至卸载并重新安装了它...没有骰子。 基本上归结为缺少对 System.IdentityModel.Tokens.ValidatingIssuerNameRegistry 的引用

因此,如果您确实通过 NuGet 将其拉下来,但仍然存在问题,请记住,当 NuGet 删除此包时,它会将其放入文件系统中位于解决方案级别的包文件夹中。

如果您的项目未显示对 System.IdentityModel.Tokens.ValidatingIssuerNameRegistry 的引用,请通过右键单击项目将程序集添加到项目中,选择添加引用、浏览,然后单击浏览按钮,然后向上浏览到 packages 文件夹并找到 dll ([Your Solution Root]packages\System.IdentityModel.Tokens.ValidatingIssuerNameRegistry.4.5.1\lib\net45 ) 并添加它。

我希望这会有所帮助。

【讨论】:

    【解决方案2】:

    我遇到了同样的问题,但对我来说它是恒定的,不是零星的,所以可能是不同的根本问题。

    我能够通过在我的 MVC 4 项目中安装以下 NuGet 包来解决此问题: http://www.nuget.org/packages/System.IdentityModel.Tokens.ValidatingIssuerNameRegistry/

    我不记得这是否是在新的 MVC 4 项目中默认添加的。我曾一度删除它,所以也许它可能已经被删除然后重新安装解决了这个问题。无论哪种方式,通过添加上面的包,我能够让我的 MVC 4 项目与 ACS 正确配合。

    希望它也对你有用。

    【讨论】:

      【解决方案3】:

      我也遇到了同样的问题。解决它的一种方法是添加对其他帖子中指定的 DLL 的引用。

      另一种选择是用这个替换部分,它使用核心 .Net Framework 4.5 中可用的类(您也必须添加对 System.IdentityModel 的引用):

      <issuerNameRegistry type="System.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
        <trustedIssuers>
          <add thumbprint="[print]" name="[issuer]" />
        </trustedIssuers>
      </issuerNameRegistry>
      

      【讨论】:

        猜你喜欢
        • 2019-04-17
        • 2022-07-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-04-02
        • 2017-10-17
        相关资源
        最近更新 更多