加载此程序集将生成与其他实例不同的授权集。(HRESULT 的异常:0x80131401)

30
我们拥有已应用了Windows更新补丁的SharePoint 2013服务器,自那时起我们一直收到以下错误。我们已重新启动服务器,手动删除Windows更新并重新启动服务器,恢复到Windows更新之前的Windows服务器副本,但错误仍然存在。我们还从Windows目录中删除了临时文件,但是没有任何帮助。
我附上了过夜应用于我们服务器的Windows更新的屏幕截图enter image description here
 Loading this assembly would produce a different grant set from other     instances. (Exception from HRESULT: 0x80131401) 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.IO.FileLoadException: Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 


[FileLoadException: Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)]
System.Linq.Enumerable.Any(IEnumerable`1 source) +0
       System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromAssemblyCollection(IEnumerable`1 assemblies, Boolean buildingFromCache) +210
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +98
System.Web.Compilation.BuildManager.ExecutePreAppStart() +139
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1005

[HttpException (0x80004005): Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +646
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +779


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET    Version:4.0.30319.36366 
4个回答

63

我在Sitecore开发中遇到了同样的异常,iisreset清除了该问题。


16
我们刚刚重新启动了应用程序池,问题已经解决。这个应用程序甚至没有使用SharePoint,只是一个普通的ASP.NET应用程序。 - Rocklan
通过 iisreset 命令解决了 SP2010 上的问题。 - Gary Henshall
对我来说这个有影响,但并没有解决问题。我有两个API。当其中一个首先被调用时,它们可以工作。但是当另一个API被使用时,就会抛出异常。所以它们都能工作,但不能同时工作。 - Mike de Klerk
3
iisreset 对我有用。有人知道是什么原因导致了这个问题吗? - amassani
我不得不重新启动IIS Express来解决这个问题,但不知道为什么会出现这种情况! - Ben D
谢谢您的提示。我在更新了许多NuGet包并将其上传到服务器后,遇到了这个问题,这是一个ASP.Net MVC项目。我打开了IIS管理器,并在“管理服务器”下点击了“重启”来解决它。在“管理网站”下的“重启”没有起作用。 - Hong

8

这对我有用。顺便问一下,你使用了32位还是64位的DWORD? - Michael Hancock
5
我并没有使用这个答案,我只是挖掘了一个被一些过于热心的stackoverflow版主删除的答案(在某个声望等级下,您可以看到已删除的答案)。我将这个被删除的答案转发给了我机构中遇到该问题的某个人。 - MarkPflug
3
FYI,链接的文章实际上说不要这样做。 - nickwesselman
@nickwesselman 第一篇文章说不要在那个特定的产品(SCOM)上这样做。第二个 Technet 论坛链接说对于第一个不同的情况应该这样做。因此,它可能仍然适用于您的特定情况。 - Shiv
已解决(VS2022,WPF 应用程序,.net7)。为什么会出现这个问题?我开发了多年的应用程序都没有出现问题。我没有使用 SharePoint。 - Soleil
工作得很好,节省了我的时间。 - undefined

1

我通过进入“绑定” -> “编辑”,然后将“localhost”作为站点的主机名删除,成功解决了这个问题。之后就可以正常工作了。


-2

如果启用了"远程桌面",请尝试禁用它(example)

运行命令isreset并更改注册表后,我的问题得到解决。

版本信息:Microsoft .NET Framework版本:4.0.30319; ASP.NET版本:4.8.4075.0


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接