how to add vc unmanaged dll to asp.net web site

Discussion in 'ASP .Net' started by Volodia, May 30, 2007.

  1. Volodia

    Volodia Guest

    Hi,

    I have a problem to find information how to add unmanaged dll
    build in VC++ 2005 to the asp.net web site

    What I have tried:
    1. use DllImport("MyDll.dll") to declare function in mypage.aspx.cs
    2. put MyDll.dll into Bin folder for ASP.Net web site

    But unfortunately an exception has been thrown

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

    Thank you,

    Volodia.
     
    Volodia, May 30, 2007
    #1
    1. Advertisements

  2. Volodia

    bruce barker Guest

    your vc++ dll is probably dependent on another dll that is not also in
    bin or system32 dir (vc++ runtime?)

    -- bruce (sqlwork.com)
     
    bruce barker, May 30, 2007
    #2
    1. Advertisements

  3. Volodia

    Volodia Guest

    List of dependancies looks ok:
    ADVAPI32.DLL
    KERNEL32.DLL
    NTDLL.DLL
    RPCRT4.DLL

    Thank you,
    Volodia
     
    Volodia, May 30, 2007
    #3
  4. Volodia

    Volodia Guest

    I have done this by creating proxy managed dll:

    1. creating managed dll
    2. Creating inside managed dll class with code that reference
    DllImport("MyDll.dll")
    3. copy managed dll and unmanaged MyDll.dll into BIN folder
    4. call in asp.net managed dll

    Thanks,
    Volodia.
     
    Volodia, Jun 1, 2007
    #4
  5. Volodia

    Volodia Guest

    I have done this by creating proxy managed dll
    Below steps I have used:

    1. Start new Class Library project
    2. Add unmanaged dll exported function description
    [DllImport("MyDll.dll")]
    private static extern int getprivatekey(StringBuilder bufUserName,
    [MarshalAs(UnmanagedType.LPStr)] StringBuilder bufUserKey);
    3. Add new function in my class
    public static string GetUserKey(string sUserName)
    4. place both managed dll and unmanaged MyDll.dll into BIN folder
    5. call in asp.net managed dll

    Thanks,
    Volodia.
     
    Volodia, Jun 6, 2007
    #5
  6. Volodia

    Guest Guest

     
    Guest, Jun 20, 2007
    #6
  7. Volodia

    Guest Guest

    :

    I have a similar problem and see all over that for years many people have
    such a problem, but I cannot find anyone who explains how to solve it, so i
    hope someone can help me.

    I get the exception message:
    Unable to load DLL 'shapelib.dll': The specified module could not be found.
    (Exception from HRESULT: 0x8007007E)

    This is one of two external third-party non-ASP.NET DLLs I reference in my
    ASP.NET 2.0 application. This application works fine when installed on a
    webserver sunning a personal operating system Windows XP 2005. However, if I
    install the application on a webserver with Webserver 2003 operating system
    it gives me this "Exception from HRESULT: 0x8007007E)" error. I know exactly
    that it is these 2 external DLLs it can't find. However, they are
    automatically installed in the bin directory when I publish the web
    application (I don't have to copy them manually or anything - Visual Studio
    knows they are needed and copies them), which is the same directory as my
    ASP.NET 2.0 dlls that reference these 2 DLLs, but it can't find them on
    Webserver 2003 OS, but works fine on XP.

    Please can someone tell me what I have to do on a webserver with WebServer
    2003 OS to make it work>

    Thanks
     
    Guest, Jun 20, 2007
    #7
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.