【发布时间】:2014-03-21 14:37:11
【问题描述】:
在运行以下两行代码时捕获了FileNotFoundException:
string strFileName = "C:\\projects\\projectname\\bin\\release\\assemblyDLLFolder\\foo.dll";
Assembly AddinAssembly = Assembly.LoadFrom(strFileName);
消息:无法加载文件或程序集 'file:///C:\projects\projectname\bin\release\assemblyDLLFolder\foo.dll' 或其依赖项之一。该系统找不到指定的文件。 异常仅在两台服务器之一上引发。
程序在一台服务器上执行,没有错误。在不同的服务器上抛出异常并且程序不执行。
什么会导致这种情况仅在 1 台服务器上发生?
【问题讨论】:
-
可能路径只存在于一台服务器上,而另一台不存在?
-
您是否检查过该文件确实存在并且可以访问?以及所有必要的参考资料。
-
猜测,要么缺少程序集,要么缺少它所依赖的程序集之一......
-
您是否尝试使用 Fuslogvw.exe 来检查此问题?见:msdn.microsoft.com/en-us/library/e74a18c4(v=vs.110).aspx
-
检查 IIS 的 AppPool 对两台服务器上该文件夹的权限
标签: c# .net-assembly filenotfoundexception system.reflection