ASP.NET server that call unmanaged DLL
-
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 callinstanciate_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 inDLLImport("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
-
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 callinstanciate_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 inDLLImport("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
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
-
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 callinstanciate_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 inDLLImport("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
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
-
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
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