&引用;找不到模块";C+错误+/ASP.NET中的CLI组件 我必须在我的ASP.NET项目中包括一个(托管)的C++/CLI组件,它引用了一些其他(非托管)C++ DLL。应该没有问题-.NET3.5在编译项目时很高兴,一切似乎都很好。C++/CLI组件和其他C++ DLL由另一个部门以Visual Studio 2005中的“任何CPU”作为发布版本编译。已安装VC++2005可再发行软件包。当我在一个普通的.NET控制台应用程序中运行相同的代码时,它不会出现问题

&引用;找不到模块";C+错误+/ASP.NET中的CLI组件 我必须在我的ASP.NET项目中包括一个(托管)的C++/CLI组件,它引用了一些其他(非托管)C++ DLL。应该没有问题-.NET3.5在编译项目时很高兴,一切似乎都很好。C++/CLI组件和其他C++ DLL由另一个部门以Visual Studio 2005中的“任何CPU”作为发布版本编译。已安装VC++2005可再发行软件包。当我在一个普通的.NET控制台应用程序中运行相同的代码时,它不会出现问题,asp.net,c++,dll,c++-cli,filenotfoundexception,Asp.net,C++,Dll,C++ Cli,Filenotfoundexception,现在,虽然此代码在控制台应用程序中工作,但ASP.NET无法正确承载它-它会导致初始页面加载出错(甚至在进入Global.asax之前)。 对于测试和调试,我使用了两种机器配置: 本地开发PC:Windows XP,32位,VC++2005 Redist包,Visual Studio 2010,ASP.NET 3.5,编译“任意CPU”,托管在Web开发服务器(Cassini)中 测试服务器(目标计算机):Windows 7,64位,VC++2005 Redist包,托管在IIS 7中,App

现在,虽然此代码在控制台应用程序中工作,但ASP.NET无法正确承载它-它会导致初始页面加载出错(甚至在进入Global.asax之前)。 对于测试和调试,我使用了两种机器配置:

  • 本地开发PC:Windows XP,32位,VC++2005 Redist包,Visual Studio 2010,ASP.NET 3.5,编译“任意CPU”,托管在Web开发服务器(Cassini)中
  • 测试服务器(目标计算机):Windows 7,64位,VC++2005 Redist包,托管在IIS 7中,AppPool设置了“启用32位应用程序”
  • 在这两台计算机上,启动ASP.NET应用程序时发生以下相同错误:

    Exception Details: System.IO.FileNotFoundException: The specified module could not be found. (Exception from HRESULT: 0x8007007E)
    
    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:
    [FileNotFoundException: The specified module could not be found. (Exception from HRESULT: 0x8007007E)]
     System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
     System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +43
     System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +127
     System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +142
     System.Reflection.Assembly.Load(String assemblyString) +28
     System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46
    
    [ConfigurationErrorsException: The specified module could not be found. (Exception from HRESULT: 0x8007007E)]
     System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +613
     System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +203
     System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +105
     System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +178
     System.Web.Compilation.WebDirectoryBatchCompiler..ctor(VirtualDirectory vdir) +163
     System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal(VirtualDirectory vdir, Boolean ignoreErrors) +53
     System.Web.Compilation.BuildManager.BatchCompileWebDirectory(VirtualDirectory vdir, VirtualPath virtualDir, Boolean ignoreErrors) +175
     System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) +86
     System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +261
     System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +101
     System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +126
     System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +62
     System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +33
     System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +40
     System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +160
     System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +93
     System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
    
    现在这很奇怪。。。它没有说明程序集丢失了什么,甚至
    Fuslogvw.exe
    sxstrace.exe
    也没有记录任何内容。 此外,CourS看来,错误取决于C++ + CLI组件或非托管C++ DLL。如果我从ASP.NET项目和代码中删除了C++/CLI程序集引用,它就可以正常工作。现在因为C++/CLI组件依赖于ASP.NET项目中未引用的本机C++,所以我将所有依赖C++的DLL复制到ASP.NET项目的输出文件夹的“bin”文件夹中(与工作控制台应用程序相同)。虽然每个C++的东西都是在发布模式下编译的,但是安装了正确的VC++ + DIST包,应该有所有的依赖关系。当然,我知道有一个
    FileNotFoundException
    ,但我无法找出缺少什么

    如:在C++中,访问C++的CLI/CLI组件的代码在两台测试PC上运行(在这里我有相同的依赖关系),其中的相同的依赖C++的DLL被部署到输出文件夹中,在ASP.NET中,我得到了上述错误。 有什么建议可以帮助我解决这个问题,或者我可以进一步跟踪它吗

    (当然,我搜索了StackOverflow和Google来查找问题,例如,我找到了这些链接,但它们没有帮助:
    -
    -
    -

    -)

    您的代码到达
    \u nLoad
    ,这很好,因为您通过了所有加载检查并移动到核心以实际加载dll,但失败了

    要开始,请下载
    Dependency Walker
    从并在dll上使用它,以了解此dll需要运行的其他资源。我怀疑无法加载其他一些dll文件

    另外,此dll可能会搜索无法找到的其他文件,这就是无法加载的原因。第二种方法是使用sysinternals中的
    文件监视器
    ,或
    过程监视器
    ,查找无法加载的内容


    ProcMon救了我

    这条路也是我的问题。似乎IIS正在C:\Windows\System32\inetsrv文件夹中创建每个托管dll的卷影副本。但对于非托管代码,情况并非如此。当它必须加载非托管dll时,它会在IIS中搜索环境路径而不是应用程序的bin目录


    非常感谢亚里士多德

    首先谢谢你。我以前使用过Dependency Walker,但没有发现任何问题。我只是想知道为什么具有相同部署程序集的.NET控制台应用程序可以工作,而ASP.NET应用程序却失败了?这很奇怪…@Matthias,正如我所写,可能是因为无法加载一些资源文件。使用文件监视器来找到它们。好,用ProcMon(第一次用户),我已经走了一步(谢谢!),但是希望你能解释结果:我看到 WebDeV.WebServ20.exe < /Cudio过程想要访问本地的C++ DLL和核心VC++DLL(MVCR80.DLL,MFC80.DLL,MSVCM80.DLL,……),而不是在部署文件夹中,但是在
    路径
    环境变量的文件夹中。现在是否有可能说服ASP.NET应用程序在其部署文件夹中使用DLL以及在
    C:\Windows\winsxs
    中部署的VC++核心文件?部署应该很简单…@Matthias可能在您运行的帐户路径上,但不在运行asp.net的池帐户路径上!在运行池的帐户上修复此问题。@Matthias登录池帐户,或者从windows的工具中更改池帐户的设置。但是您是如何解决此问题的?已将bin文件夹添加到路径?