Debugging ASP.NET web service, C++/CLI DLL, and native DLL in Visual Studio 2008

I have a VS2008 solution with three projects: C# ASP.NET web service, which is using C++/CLI DLL, which in turn is calling functions of native C++ DLL. All references are properly set. In web service bin folder there are all three DLL's. Problem is when I hit F5 the page in my browser informs me about FileNotFoundException from HRESULT 0x8007007E, The specified module could not be found.

The missing module is my native DLL. ASP.NET Development Server copies (and uses) my C++/CLI DLL somewhere in %USERPROFILE%AppDataLocalTempTemporary ASP.NET Filesroot , but not the native one. If I manually copy native DLL to the same folder with C++/CLI DLL then I can debug my web service. However, this copying does not seem right.

Copying native DLL somewhere on PATH does not feel right either, because other developers need to remember it.

There is a similar question here, and a blog post linked in one answer. The given solution requires that I change DLL's to be delay-loaded, which again seems to much of a half-baked workaround, because it requires to change the end product due to development hurdles.

Is there a proper way to debug a combination of web service, C++CLI DLL, and native DLL?


The issue is simply that the compiler can't figure out where the native c++ library is.

So, there are a couple ways to fix that.

  • Use DLLImport to load the dll using a relative or absolute path at runtime.
  • Set the path environment variable to it's location.
  • Get really complicated in how the project is built (see link below, which you've obviously already read).
  • http://blogs.msdn.com/b/jorman/archive/2007/08/31/loading-c-assemblies-in-asp-net.aspx

    There's no real answer beyond those.

    链接地址: http://www.djcxy.com/p/95390.html

    上一篇: 发布模式VS MS Visual Studio Windows中的DEbug模式

    下一篇: 在Visual Studio 2008中调试ASP.NET Web服务,C ++ / CLI DLL和本机DLL