gpt4 book ai didi

c# - DLL 版本控制错误

转载 作者:可可西里 更新时间:2023-11-01 07:56:32 24 4
gpt4 key购买 nike

我有一个偶尔会抛出以下错误的网站:

Server Error in '/' Application.

Could not load file or assembly 'ICSharpCode.SharpZipLib, Version=0.85.3.365, Culture=neutral, PublicKeyToken=1b03e6acf1164f73' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

现在我知道我确实依赖这个 DLL,但我的系统上有 0.85.5 版本。我已经系统地从服务器上删除了所有旧版本的 DLL,重新编译所有内容并重新发布。但无论我做什么,似乎每次重新发布后,有人访问该网站的前一两次,他们都会收到此错误。然后在刷新一两次后,错误消失,网站正常运行。

更奇怪的是,如果我查看引发错误的代码行:

URLRewriter.ProcessRewritingResult(status, excludedEnum, siteName, viewMode, relativePath);

URLRewriter 是来自第 3 方包的类 (Kentico CMS - CMS.URLRewritingEngine.dll)。我在那个 DLL 上运行 Dependency Walker,发现没有任何依赖于 ICSharpCode.SharpZipLib。

有什么办法解决这个问题吗?

编辑:在@JeremyThompson 的建议下,我运行 Process Monitor 来捕获错误。这是一个屏幕转储,其中突出显示了相关部分(并且出于隐私原因隐藏了一个文件夹名称)。您可以通过右键单击它等来查看它的全尺寸...

enter image description here

编辑:这是错误的负载轨迹。这有帮助吗?

=== Pre-bind state information ===

LOG: User = MY-SERVER-12\Administrator

LOG: DisplayName = ICSharpCode.SharpZipLib, Version=0.85.3.365, Culture=neutral, PublicKeyToken=1b03e6acf1164f73 (Fully-specified)

LOG: Appbase = file:///C:/inetpub/wwwroot/MySite/

LOG: Initial PrivatePath = C:\inetpub\wwwroot\MySite\bin

Calling assembly : CMS.WebAnalytics, Version=6.0.4377.2467, Culture=neutral, PublicKeyToken=834b12a258f213f9.

===

LOG: This bind starts in default load context.

LOG: Using application configuration file: C:\inetpub\wwwroot\MySite\web.config

LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config

LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.

LOG: Post-policy reference: ICSharpCode.SharpZipLib, Version=0.85.3.365, Culture=neutral, PublicKeyToken=1b03e6acf1164f73

LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/9760eb69/275bb3db/ICSharpCode.SharpZipLib.DLL.

LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/9760eb69/275bb3db/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.DLL.

LOG: Attempting download of new URL file:///C:/inetpub/wwwroot/MySite/bin/ICSharpCode.SharpZipLib.DLL.

LOG: Attempting download of new URL file:///C:/inetpub/wwwroot/MySite/bin/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.DLL.

LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/9760eb69/275bb3db/ICSharpCode.SharpZipLib.EXE.

LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/9760eb69/275bb3db/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.EXE.

LOG: Attempting download of new URL file:///C:/inetpub/wwwroot/MySite/bin/ICSharpCode.SharpZipLib.EXE.

LOG: Attempting download of new URL file:///C:/inetpub/wwwroot/MySite/bin/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.EXE.

最佳答案

Now I know that I do have a dependency on this DLL, but I have version 0.85.5 on my system. I have systematically deleted every older version of the DLL from the server, recompiled everything and republished.

听起来“依赖项”需要 OLDER 版本的 DLL。为什么不使用 版本 (0.85.3.365) REPLACE 您系统上所有较新 版本 (0.85.5) 的副本? (确保同时检查 Web 应用程序的“bin”文件夹和“GAC”:c:\windows\assemblies)

如果需要,可以在这里下载旧版本:http://sourceforge.net/projects/sharpdevelop/files/SharpZipLib/0.85.3/

注意:

  • 替换 DLL 后,停止 IIS 并清除所有临时 ASP.Net文件。例如。:C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET文件
  • 另外:记得更新您的 Visual Studio 解决方案,以便它引用旧版本。

干杯

皮特

关于c# - DLL 版本控制错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11490177/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com