引用C++ DLL运行C ASP.NET Web服务时,找不到指定的模块

引用C++ DLL运行C ASP.NET Web服务时,找不到指定的模块,asp.net,c++,web-services,dll,dependencies,Asp.net,C++,Web Services,Dll,Dependencies,我在Visual Studio 2005中有一个C ASP.NET Web服务项目,它引用了一个C++ DLL。但是,当我尝试运行web服务时,会出现以下错误,显示在web浏览器中: The specified module could not be found. (Exception from HRESULT: 0x8007007E) Description: An unhandled exception occurred during the execution of the curre

我在Visual Studio 2005中有一个C ASP.NET Web服务项目,它引用了一个C++ DLL。但是,当我尝试运行web服务时,会出现以下错误,显示在web浏览器中:

The specified module could not be found. (Exception from HRESULT: 0x8007007E)  
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.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.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +83
System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath) +10
System.Web.UI.WebServiceParser.GetCompiledType(String inputFile, HttpContext context) +43
System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath) +180
System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +193
System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +93
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
但是,我在同一个解决方案中为windows窗体应用程序引用了相同的dll,它工作正常。为了让这个windows应用程序工作,我使用Dependency Walker软件来解析dll的几个依赖项。但是当我尝试运行web服务时,我不知道如何解决这个错误。我的操作系统是Windows 7 Ultimate 64位

我能知道为什么会出现此错误以及如何解决此问题吗?
谢谢

< P>我猜你的C++ DLL很可能是非托管代码。

你引用的C++ DLL,它是在32位或64位? windows应用程序可以工作,因为您 启动这一进程。 web应用程序正在中运行 web服务器的应用程序池 它被设置为以32位运行 或64。 在IIS管理器中,选择应用程序 游泳池。在申请表中 池,选择您要创建的应用程序池 已为您的web应用程序配置。在行动中 窗格中,选择“高级设置”下的 编辑应用程序池。扩展 常规设置,设置启用32位 应用程序设置为True,然后单击确定


我在尝试通过CLICKONE部署一个C程序,调用一个管理非C++ DLL的托管C++ DLL。错误是无法加载引用或程序集[managed dll]或其先决条件之一,第二行表示找不到它,尽管我可以在deployed文件夹的应用程序文件中看到dll。下面的链接提到目标计算机上可能没有安装正确的可再发行软件包,事实就是这样。CLIKONE必备条件POPUT菜单允许在我的例子中选择VisualC++ 14运行库X86。在安装新构建的应用程序时,安装程序要求用户下载此软件,然后我可以在目标机器上运行该应用程序


希望这有帮助:C++ DLL引用作为一个项目添加,并被编译为64位。我甚至不知道如何用64位编译它。我不太熟悉这种托管和非托管代码。然而,它主要是用原生的C++。这就是问题的原因吗?一直以来,我都在尝试在VisualStudioDevelopmentServer中运行它。在IIS中运行似乎是一项非常困难的任务。正如您所解释的,当我尝试使用IIS时,现在应用程序甚至没有启动web浏览器。相反,它给出了一个很大的错误屏幕:我也可能错了,这可能不是问题的原因,但它是值得考虑的。未找到引用,请右键单击引用并检查属性、路径,并将“复制本地”设置为true。如果这个非托管dll是您的,并且在同一个解决方案中,那么它可以简单地用32位编译,Build->Configuration Manager。列出了您的解决方案中的项目,来自c托管代码的项目具有任何CPU平台,因为它们是在timeJIT中编译的,以适应应用程序的位模式,而非托管时,您可以选择一个新的平台win32或x64。继续您可以阅读一下Visual Studio Configuration Manager,将新的win32和x64平台添加到平台列表中。要在IIS中承载web应用,请首先检查您的win7上是否已完全安装IIS,包括IIS的所有子功能此版本的IIS能够承载此功能。典型的步骤是创建虚拟目录,添加应用程序池;或者看看是否可以简单地使用VisualStudio将IIS配置为直接从当前文件夹运行web应用程序。右键单击Web项目,属性,应该有标签称为Web,使用本地IIS,创建虚拟目录。引用C++ DLL可以是一个高级主题,阅读上面提供的Isalamon链接将有所帮助。就像我之前说过的,也许我在一个侧边上关注C++的参考,如果没有解决的话,让我们看看其他人是否有不同的输入来帮助你解决它。