本文介绍了使用Web服务时出现问题(正在使用Manged dll)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发 Web服务以使用托管的C ++ dll (C ++/CLI dll).
该托管的C ++ dll反过来利用未管理的(本机)C ++ dll [通过LoadLibrary ....]

我已将此管理的dll添加到我的Web服务中作为参考(以及所有它引用的程序集).现在,当我尝试在ASP或C#客户端中使用此Web服务时,我得到了:

*******错误日志启动*********

找不到指定的模块.(来自HRESULT的异常:0x8007007E)"
说明:执行当前Web请求期间发生未处理的异常.请查看堆栈跟踪,以获取有关错误及其在代码中起源的更多信息.

异常详细信息:System.IO.FileNotFoundException:找不到指定的模块. (来自HRESULT的异常:0x8007007E)

源错误:

当前Web请求的执行期间生成了未处理的异常.可以使用下面的异常堆栈跟踪来标识有关异常的来源和位置的信息.

堆栈跟踪:

[FileNotFoundException:找不到指定的模块. (来自HRESULT的异常:0x8007007E)]
System.Reflection.Assembly._nLoad(AssemblyName文件名,字符串codeBase,证据AssemblySecurity,程序集locationHint,StackCrawlMark& stackMark,布尔型throwOnFileNotFound,布尔型用于自省)+0
System.Reflection.Assembly.nLoad(AssemblyName文件名,字符串codeBase,证据assemblySecurity,程序集locationHint,StackCrawlMark& stackMark,布尔throwOnFileNotFound,布尔forIntrospection)+43
System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef,证据assemblySecurity,StackCrawlMark& stackMark,用于自省的布尔值)+127
System.Reflection.Assembly.InternalLoad(字符串assemblyString,证据assemblySecurity,StackCrawlMark& stackMark,用于自省的布尔值)+142
System.Reflection.Assembly.Load(String assemblyString)+28
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(字符串assemblyName,布尔型starDirective)+46

...................

*******错误日志结束*********

但是我可以在C#控制台应用程序中引用相同的托管dll(从与webservice相同的位置),这证明所有必需的依赖项都可用.
任何人都可以给我提示/方向来解决此问题.

在Web服务中调用托管dll(利用非托管dll)时会发生什么特别的事情?

I am developing a Webservice for consuming a Managed C++ dll (C++/CLI dll).
This managed C++ dll is in turn utilizing unmanged (native) C++ dlls [via LoadLibrary ....]

I have added this manged dll to my webservice as reference (and also all it''s refered assemblies). Now when I try to use this webservice in ASP or C# client I am getting :

******* Error log start *********

"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

...................

******* Error log end *********

But the same manged dll I could able to refer (from the same location as I refered from webservice) in an C# console application, which proves that all the required dependencies are available.

Can any one please give me hints/directions to solve this issue.

Any thing peculiar in invoking manged dlls (utilizing unmanaged dlls) in webservice ?

推荐答案



这篇关于使用Web服务时出现问题(正在使用Manged dll)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 22:08