locked
Unable to load DLL 'foo.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E) RRS feed

  • Question

  • User1979174319 posted
    I have .Net 1.1  Application that works fine with the same dll, after redesigning application to 2.o Framework I have this error, I tried to compile it with /MT (this is C++ project in ANSI C, planned to be working on different platforms), but had no luck. Even tryed to make dummy dll  with function doing nothing - still didn't work. What can be problem and how to fix it?
    Tuesday, November 22, 2005 3:32 PM

All replies

  • User-1435421792 posted
    I am getting the same error message.  "The specified module could not be found. (Exception from HRESULT: 0x8007007E)"  Just wondering if you found a solution to this problem.  My problem is a little bit different.  I compile a DLL under VS2003 (.NET 1.1) run it on my development machine which is running VS2005 (.NET 2.0).  My Web Application runs just fine using my DLL on my development machine.  When I copy the web app to my production server i get the message above.  The server is running windows 2000 server with (.NET 2.0) intstalled.
    Friday, December 9, 2005 4:50 PM
  • User-987726656 posted

    I have the same problem with the only difference that the component that causes the problem is a third party component.

    Got any clues why this only happens when deployed to server?

    I use a WinXP Pro machine for development and there it works perfectly, but the production server running on Windows 2000 Standard Server refuses to work.

    /Per Salmi

    Wednesday, December 14, 2005 1:48 PM
  • User1291151714 posted

    We have received several feedback about this exception. So far they are related with native files (.dll or .lib) referenced by managed dll are not in the PATH.

    Some suggestion here:

    You need to figure out which managed dll, native dll and lib files are referenced by your application (directly or indirectly).

    For managed dll, make sure they are in the web's bin folder.

    For native dll and .lib files, check out whether those .dll and .lib files are in the PATH. If not, you can either copy them to there; or, you can put them into a folder and add that folder into the PATH. Then restart VS and IIS (command "iisreset") to make sure the setting is picked up.

    By the way, putting all of the files in the web's bin folder won't help. The reason is CLR copies the files into a temporary folder under framework directory and run the web there, but CLR only copies away managed dll (not the native ones), so you still get "module not found" error.

    I have reproduced this error using the following sample solution

       1. Web1 references a managed c++ project say "MCpp1.dll". The project further references two unmanaged c++ projects with the output say "Lib1.lib" and "Lib2.lib"

       2. If I copy all of those files into web's bin folder, I get the exception of "module not found error".

       3. I create a folder say "C:\Lib" and copy "Lib1.lib" and "Lib2.lib" into it and add this folder into PATH. I restart VS, and also run "IISReset" since I have a IIS web

       4. Open VS and request a page and it works now

    You can also feel free to send me some sample webs demonstrating this issue at yugangw at microsoft dot com. I will be very happy to take a look and figure out the issues for you.

    I have also contacted the CLR/Fusion team for suggestion of how to get the related module name when this exception happens, which should be very helpful to make diagnosis.

    Hope this helps

       Yugang 

    Thursday, December 15, 2005 8:20 PM
  • User-987726656 posted

    I have had this problem with two completely different projects using different components. Both actually was missing the "msvcr71.dll" that is not included in the .Net Framework 2.0 installation. So the explanation was correct even if the detail info on the exact dll that was missing came from one of the component makers support people.

    /Per Salmi

    Friday, December 16, 2005 7:08 AM
  • User1786436407 posted

    I too am having this issue.

    What is the "PATH"?

    Is this something in the solution file, web config file, assembly a specific folder on the machine or something different?

    If you don't know the answer already this reply is no help at all.

    Searching for "Path" in the help yields far too many irrelevant results.

    Is there a KB on this?

    Thursday, March 16, 2006 8:10 AM
  • User1786436407 posted

    As an addition to my previous post I now realise that you are on about the PATH environment variable.

    Hopefully this will help someone else finding this page through Google

    Thursday, March 16, 2006 8:26 AM
  • User-1472734613 posted

     Hi Friends

    After so much of headache, at last i was able to find a solution for my problem.

    Solution is :-
    "ABCpdfCE6.dll" (in BIN Folder) should have the Rights for "Read and Execute" for IIs User(IUSER) which can be given from Control Panel on a Shared Server.

    Hope this helps for others also..

    Bye and Take care and

    HAPPY PROGRAMMING

    Monday, January 7, 2008 4:42 AM
  • User-422585983 posted

    Thanks Yugang.  I added the third party dll to the class path.  restarted the VS and I am off and running.

     

    Wednesday, February 11, 2009 2:22 PM
  • User1116733743 posted

    Thanks.

    I added the path to the envronment variables and it worked.

     

    Tuesday, April 7, 2009 2:17 AM
  • User-455811767 posted

    Hi I didn't find Shared Server in COntrol Panel,

    Can u Explain me step by step How Could u Resolve Ur Problem,iam also facing Same Problem.

    thanks

    Srinu.

    Monday, August 24, 2009 2:08 AM
  • User-455811767 posted

    hi

    i developed a webservice,i added C++ managed reference to my webservice,

    when i run my service it shown error like this

    The specified module could not be found. (Exception from HRESULT: 0x8007007E)

    then i checked Dll Dependencoies using DllWacher ,intially its showing Some Dlls Misisng 

    i resolved that problems by downloading missing DLLs,then its working fine in File System( Visual Studio 2005).

    But When I Configured in IIS It Showing Same Error As Above..

    Please have look at my problem..

    Thanks

    Srinu..

    Saturday, August 29, 2009 5:14 AM
  • User1089328132 posted

    Hi, I wrote this in IMB developerWorks, hope this helps:

    IIS has a bug!!

    If you are trying to use IBM.Data.Informix (Client 2.81 TC3, 2.9, 3.5, etc.) from IIS, and you still have this problem, I have a solution. I found that IIS 5.1 has a bug!!. IIS cannot read the entire PATH environment variable if it’s too long (my PATH has 1364 characters). So if your informix dir is near the end of your PATH and your PATH is too long, IIS will never read your informix dir ("C:\Program Files\IBM\Informix\Client-SDK\bin"). Just put your informix dir at the beginning of your PATH variable, and very important execute an "iisreset" and the issue will gone away. I don't know if this bug remains in IIS 6.0 or later. But you can try this.

    If I'm correct this will help to solve other problems when you're trying to access unamanaged dlls from IIS:
    "Unable to load DLL 'foo.dll': The specified module could not be found."

    Best regards

     

    Sunday, August 30, 2009 12:33 PM
  • User-912990937 posted

    Thanks Yugang. I get this error when I put my C++ dll in the App_Code folder. If I specify the full path in the DllImport, then it finds it, and I can call my dll. But if I just name the dll, and expect it to look in the App_Code folder, then it gives me the "specified module" error. If I am debugging in VS2008, and put in the full path, and run it successfully, and then REMOVE everything except the name of the dll without closing out of VS2008, then it still works until I get out of VS2008. My ASP.NET site is hosted by a third party, and I can't go changing their environment variables. Is there any way to specify in the web.config that it should look for my dll in the App_Code folder? Thanks.

    Thursday, June 24, 2010 12:08 PM
  • User-912990937 posted

    I just went through all the system calls in alphabetical order, and found one that gives me the directory where my Web site resides, namely:

    HttpRuntime.AppDomainAppPath

    However, when I try to do the following it gives me a compile error:

    const string dllLocation = HttpRuntime.AppDomainAppPath + "\\App_Code\\mydll.dll";
    [DllImport(_dllLocation)]

    It seems it doesn't think HttpRuntime.AppDomainAppPath is constant enough to assign. However, if I take the const away, it complains that DllImport refers to a non-static. If I try writing a routine:

    String GetAppPath()
    {
    return HttpRuntime.AppDomainAppPath;
    }

    [DllImport(GetAppPath)]     //or [DllImport(GetAppPath()]

    it doesn't know how to parse that. Soooo... Any suggestions?

    Thursday, June 24, 2010 4:39 PM
  • User1920576774 posted

    You are a Genius! nice find. 

    Tuesday, October 26, 2010 2:56 PM