gpt4 book ai didi

asp.net - 运行引用 C++ dll 的 C# ASP.NET Web 服务时出现 "The specified module could not be found"错误

转载 作者:太空宇宙 更新时间:2023-11-04 14:26:52 26 4
gpt4 key购买 nike

我在 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 位

我能知道我为什么会收到此错误以及如何解决吗?谢谢

最佳答案

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

你引用的 C++ dll,它是用 32 位还是 64 位编译的?

  • Windows 应用程序运行正常,因为您启动进程。
  • 网络应用正在运行Web 服务器的应用程序池设置为以 32 位运行或 64。

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.

关于asp.net - 运行引用 C++ dll 的 C# ASP.NET Web 服务时出现 "The specified module could not be found"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3180367/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com