“找不到指定的模块”错误时运行C#ASP.NET Web服务引用C ++ DLL [英] "The specified module could not be found" error when running C# ASP.NET web service referring C++ dll

查看:976
本文介绍了“找不到指定的模块”错误时运行C#ASP.NET Web服务引用C ++ DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有C#ASP.NET web服务项目在visual studio 2005中提到一个C ++ DLL。但是当我尝试运行Web服务时,我得到以下错误,显示在Web浏览器中:

I have C# ASP.NET web service project in visual studio 2005 which refers a C++ dll. But when I try to run the web service I get the following error which is shown in the web browser:

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

但是我在同一个解决方案中引用相同的dll for windows form应用程序,工作正常。对于这个Windows应用程序工作我使用Dependency Walker软件来解决dll的少数依赖。但我不知道如何解决这个错误,当我尝试运行Web服务。我的操作系统是Windows 7 Ultimate 64位

However I refer the same dll for windows form application in the same solution and it is working fine. For this windows application to work I used Dependency Walker software to resolve few dependencies of the dll. But I can't figure out how to resolve this error when I try to run the web service. My operating system is Windows 7 Ultimate 64 bit

我可以知道为什么我得到这个错误,以及如何解决这个问题?
感谢

Can I know why I m getting this error and how to resolve this ? thanks

推荐答案

我的猜测是你的C ++ dll可能是非托管代码。

My guess is your C++ dll is likely unmanaged code.

您正在参考的C ++ dll是以32位或64位编译的?

The C++ dll you're refering, it's compiled in 32bit or 64?


  • windows应用程序工作,因为你是
    启动过程。

  • 网络应用程序在
    中运行Web服务器的应用程序池
    ,设置为在32位
    或64中运行。


在IIS管理器中,选择Application
Pools。在应用程序
Pools的列表中,选择
为您的Web应用程序配置的应用程序池。在操作
窗格中,选择
下的高级设置编辑应用程序池。展开
常规设置,将32位
应用程序设置为True,然后单击确定。

In IIS Manager, select Application Pools. In the list of Application Pools, select the application pool you have configured for your web app. In the Actions pane, select Advanced Settings under Edit Application Pool. Expand the General settings, set Enable 32-bit Applications to True, and click OK.

这篇关于“找不到指定的模块”错误时运行C#ASP.NET Web服务引用C ++ DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆