无法加载文件或程序集"Microsoft.AspNet.Security.DataProtection" [英] Could not load file or assembly 'Microsoft.AspNet.Security.DataProtection'

查看:76
本文介绍了无法加载文件或程序集"Microsoft.AspNet.Security.DataProtection"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

升级到最新版本的asp.net-5堆栈时,在尝试访问SignalR集线器时遇到以下堆栈跟踪.

When upgrading to the latest versions of the asp.net-5 stack, I encountered the following stack trace while attempting to access my SignalR hub.

<代码>FileNotFoundException:无法加载文件或程序集"Microsoft.AspNet.Security.DataProtection,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null"或其依赖项之一.该系统找不到指定的文件.System.RuntimeTypeHandle.GetTypeByName(字符串名称,布尔throwOnError,布尔ignoreCase,布尔反射Only,StackCrawlMarkHandle stackMark,IntPtr pPrivHostBinder,布尔loadTypeFromPartialName,ObjectHandleOnStack类型)System.RuntimeTypeHandle.GetTypeByName(字符串名称,布尔throwOnError,布尔ignoreCase,仅布尔反射,StackCrawlMark& amp; Mark,IntPtr pPrivHostBinder,布尔loadTypeFromPartialName)System.RuntimeType.GetType(字符串类型名称,布尔throwOnError,布尔ignoreCase,布尔布尔仅反射,StackCrawlMark& stackMark)System.Type.GetType(String typeName,布尔throwOnError)Microsoft.AspNet.DataProtection.KeyManagement.XmlKeyManager.ParseKeyElement(XElement keyElement)Microsoft.AspNet.DataProtection.KeyManagement.XmlKeyManager.GetAllKeys()Microsoft.AspNet.DataProtection.KeyManagement.KeyRingProvider.CreateCachedKeyRingInstanceUnderLock(DateTime utcNow,CachedKeyRing existingCachedKeyRing)Microsoft.AspNet.DataProtection.KeyManagement.KeyRingProvider.GetCurrentKeyRing()Microsoft.AspNet.DataProtection.KeyManagement.KeyRingBasedDataProtector.Protect(Byte [] unprotectedData)Microsoft.AspNet.SignalR.Infrastructure.DataProtectionProviderProtectedData.Protect(字符串数据,字符串用途)

我了解到该程序集已重命名为Microsoft.AspNet.DataProtection,并且从aspnet github存储库中看到,此SEEMS更改已遍及其他项目.

I understand that this assembly has been renamed Microsoft.AspNet.DataProtection and I see from the aspnet github repositories that this change SEEMS to have rippled through the other projects.

我删除了所有对旧程序集的引用,搜索了.k目录,我的项目目录,我的GAC,所有内容的全部内容.

I have deleted all references to the old assembly, searched the ENTIRE contents of the .k directory, my project directory, my GAC, EVERYTHING.

推荐答案

当然,经过4个小时的尝试,我发现问题的根源在于奇怪的原因:

Of course, after 4 hours of trying to figure this out, I discover the bizarre cause of it right after I post the question:

之所以对整个硬盘驱动器进行任何可能的提述,都无济于事,这是因为对它的引用被巧妙地加密了在旧版本的程序集所创建的我的%APPDATA%目录中的XML文件中!

The reason why scouring my entire hard drive for any possible mention of the old assembly turned up nothing is because the reference to it was cleverly ENCRYPTED in an XML file in my %APPDATA% directory created by the old version of the assembly!

当使用新的程序集名称升级到新版本时,必须删除目录的内容:%APPDATA%\ Local \ ASP.NET \ keys-BETA否则将出现此错误!此目录中的xml文件包含解密程序的程序集合格类名的加密表示形式,它将使用旧的"Security.DataProtection"程序集而不是新的程序集.

When upgrading to the new version with the new assembly name, you MUST delete the contents of the directory: %APPDATA%\Local\ASP.NET\keys-BETA or you will end up with this error! The xml file in this directory contains an encrypted representation of the assembly-qualified classname of the decryptor, which will be using the old "Security.DataProtection" assembly instead of the new one.

这篇关于无法加载文件或程序集"Microsoft.AspNet.Security.DataProtection"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆