Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. ASP.NET server that call unmanaged DLL

ASP.NET server that call unmanaged DLL

Scheduled Pinned Locked Moved ASP.NET
csharpc++helpasp-netwinforms
4 Posts 3 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Le Sourcier
    wrote on last edited by
    #1

    Hello, I have a critical problem :mad: with my ASP.NET server :~. In fact, I want my ASP.NET code behind (C#) to call a DLL (C++, unmanaged and without COM). I tried to use [DLLImport("MyDLL.DLL")] public extern static void instanciate_unmanaged_process(); Unfortunately, each time I call instanciate_unmanaged_process(); a new System.DLLNotFoundException is thrown. I have tried to put my DLL in many directories (current, system32, asp.net bin) and it does not work. Then I tried to write the full path in DLLImport("c:\\projects\\bin\\MyDLL.DLL"), but the same exception appears. :sigh: :sigh: :sigh: :sigh: :sigh: :sigh: I have tried to make a managed dll wrapper, but it does not work anymore. (same exception) :omg: I tried the old LoadLibrary/GetProcAdress way, and GetProcAdress is still returning null. :wtf: It works fine through a Winforms application but not through asp.net.:confused: Someone could help me ? Using: VS2008 Pro Framework 3.5 (almost 2.0 for ASP.NET server) Web server with IIS 6.0 (win xp) Unmanaged DLL compiled with Visual C++ 6 Thanks a lot.

    Le Sourcier

    E F 2 Replies Last reply
    0
    • L Le Sourcier

      Hello, I have a critical problem :mad: with my ASP.NET server :~. In fact, I want my ASP.NET code behind (C#) to call a DLL (C++, unmanaged and without COM). I tried to use [DLLImport("MyDLL.DLL")] public extern static void instanciate_unmanaged_process(); Unfortunately, each time I call instanciate_unmanaged_process(); a new System.DLLNotFoundException is thrown. I have tried to put my DLL in many directories (current, system32, asp.net bin) and it does not work. Then I tried to write the full path in DLLImport("c:\\projects\\bin\\MyDLL.DLL"), but the same exception appears. :sigh: :sigh: :sigh: :sigh: :sigh: :sigh: I have tried to make a managed dll wrapper, but it does not work anymore. (same exception) :omg: I tried the old LoadLibrary/GetProcAdress way, and GetProcAdress is still returning null. :wtf: It works fine through a Winforms application but not through asp.net.:confused: Someone could help me ? Using: VS2008 Pro Framework 3.5 (almost 2.0 for ASP.NET server) Web server with IIS 6.0 (win xp) Unmanaged DLL compiled with Visual C++ 6 Thanks a lot.

      Le Sourcier

      E Offline
      E Offline
      Ernest Laurentin
      wrote on last edited by
      #2

      Interesting question... OK, did you try to create a .NET assembly wrapper instead to add it directly in your code? I suppose that if could install the new assembly in the GAC, you should be able to have your DLL in \system folder.

      God bless, Ernest Laurentin

      1 Reply Last reply
      0
      • L Le Sourcier

        Hello, I have a critical problem :mad: with my ASP.NET server :~. In fact, I want my ASP.NET code behind (C#) to call a DLL (C++, unmanaged and without COM). I tried to use [DLLImport("MyDLL.DLL")] public extern static void instanciate_unmanaged_process(); Unfortunately, each time I call instanciate_unmanaged_process(); a new System.DLLNotFoundException is thrown. I have tried to put my DLL in many directories (current, system32, asp.net bin) and it does not work. Then I tried to write the full path in DLLImport("c:\\projects\\bin\\MyDLL.DLL"), but the same exception appears. :sigh: :sigh: :sigh: :sigh: :sigh: :sigh: I have tried to make a managed dll wrapper, but it does not work anymore. (same exception) :omg: I tried the old LoadLibrary/GetProcAdress way, and GetProcAdress is still returning null. :wtf: It works fine through a Winforms application but not through asp.net.:confused: Someone could help me ? Using: VS2008 Pro Framework 3.5 (almost 2.0 for ASP.NET server) Web server with IIS 6.0 (win xp) Unmanaged DLL compiled with Visual C++ 6 Thanks a lot.

        Le Sourcier

        F Offline
        F Offline
        Fastfootskater
        wrote on last edited by
        #3

        Hi, I have exactly the same problem! Have you found a solution? Interersting is that it works under the ASP Development server but not with IIS ! greetings from the lake of Constance, Germany Juergen

        L 1 Reply Last reply
        0
        • F Fastfootskater

          Hi, I have exactly the same problem! Have you found a solution? Interersting is that it works under the ASP Development server but not with IIS ! greetings from the lake of Constance, Germany Juergen

          L Offline
          L Offline
          Le Sourcier
          wrote on last edited by
          #4

          Hi, The ASP.NET engine seems to have problems with calling unmanaged DLL. You can call unmanaged DLL with Interopservces with such a code [DllImport("ImportCoreASPNET.DLL", EntryPoint = "?import_4aspnet_start_it@@YAHPBD@Z")] static extern int import_4aspnet_start_it(string filename); there are two requisites: 1. place the dll in a directory included in PATH (environment variable) 2. make sure that the dll does not call other DLL. (I had problem with one dll calling 3 others, and dll or entrypoints are never found) So I had to merge my dlls in unique one to make it works with ASP.NET. Regards,

          Le Sourcier

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups