我的.NET可执行文件
似乎加载器误解了从网络共享加载的意图,并删除了“\\localhost”以使用“C:”。 问题似乎与安全设置无关(我从未在我的计算机上搞过CASPOL),我正在使用.NET 3.5 SP1,该版本允许从共享启动可执行文件。通过等效映射的网络驱动器字母启动程序的事实应该确认这不是安全问题。问题也与引用到EXE程序集的事实无关,因为对普通DLL程序集的引用会产生相同类型的加载错误。有什么想法可以导致此加载问题?是否有人遇到过这种情况?
abc.exe
引用了几个程序集,其中一个叫做xyz.core.exe
。当它从通过共享名称指定的网络位置启动时,例如\\localhost\xyz\abc.exe
,我遇到了一些问题。如果我将名为Z:
的网络驱动器映射到\\localhost\xyz
,并启动Z:\abc.exe
,则可以正常工作。
.NET似乎在尝试从共享中加载xyz.core.exe
程序集时变得混乱。它抛出一个System.IO.FileNotFoundException
异常,并提供以下融合日志信息:
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable \\localhost\xyz\abc.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = Workstation\arnaud
LOG: DisplayName = xyz.core, Version=2.5.2.1001, Culture=neutral, PublicKeyToken=...
(Fully-specified)
LOG: Appbase = file://localhost/xyz/
LOG: Initial PrivatePath = NULL
Calling assembly : abc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=...
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: xyz.core, Version=2.5.2.1001, Culture=neutral, PublicKeyToken=...
LOG: Attempting download of new URL file://localhost/xyz/xyz.core.DLL.
LOG: Attempting download of new URL file://localhost/xyz/xyz.core/xyz.core.DLL.
LOG: Attempting download of new URL file://localhost/xyz/xyz.core.EXE.
LOG: Attempting download of new URL file://localhost/xyz/xyz.core/xyz.core.EXE.
通过使用Process Monitor,我从另一个角度观察到了一些尝试访问本地驱动器的路径:
C:\xyz\xyz.core.dll
C:\xyz\xyz.core\xyz.core.dll
C:\xyz\xyz.core.exe
C:\xyz\xyz.core\xyz.core.exe
似乎加载器误解了从网络共享加载的意图,并删除了“\\localhost”以使用“C:”。 问题似乎与安全设置无关(我从未在我的计算机上搞过CASPOL),我正在使用.NET 3.5 SP1,该版本允许从共享启动可执行文件。通过等效映射的网络驱动器字母启动程序的事实应该确认这不是安全问题。问题也与引用到EXE程序集的事实无关,因为对普通DLL程序集的引用会产生相同类型的加载错误。有什么想法可以导致此加载问题?是否有人遇到过这种情况?