Hello, Please Help us...!
I have a big problem ,so i searched on google and other search engine ,then I realized that so many other people have the same problem and they, all, have'nt been able to solve it.
My problem is:
I want to import a dll in asp.net, and I have a major problem
First i want to say that this dll works fine in a windows application written in C#, and It works fine when I use the ASP.NET development server (Local machine).
But when I run the this code in Local host ( I upload it to my webserver ) ,asp.net know its Functions, but dont return anything or return wrong output adn return true output for sometimes.
Can it be something with the security rights the IIS has? or Web.config? or my way to Import?
......
for Example this Function code is:
[DllImport("mydll.dll")]
public static extern int GetTotal();
and when i call that ( in localhost )...
Response.Write( GetTotal().ToString() );
Output is: "-1" But when i use the ASP.NET development server (Local machine) It works fine, and Output is: "67"
.....
this Function works proprely in both ( Localhost and LocalMachine ):
[DllImport("mydll.dll")]
public static extern string ErrorDescription(int errorcode);
and when i call that ...
Response.Write( ErrorDescription(3) );
output in Localhost and Localmachine is : "invalid Account" !! therefore it works file in both.
......
this Function don't return anything in local host :
[DllImport("mydll.dll")]
public static extern string ServerGet(int index);
and when i call that ...
Response.Write( ServerGet(1) );
output in Localhost is empty! but in local machine output is : "219.39.43.34:244"
.....
i am sure that Asp.net knows this DLL well, and if it did'nt recognize it would give me an error, but my problem is that my dll do'nt works proprely when i run it in IIS.
do you know any solution ?
Can it be something with the IIS permissions?
=================================
some of the problems are mentioned below :
=================================
Hello,
I?m trying to use an unmanaged C dll from a ASP.NET 2.0 web application using p/Invoke platform (dllImport attribute). The asp.net page instances a c# library and this loads the C dll.
I?ve used this dll from a windows application without problems. But if this dll is invoked from a Web site it always return this error:
?Attempted to read or write protected memory. This is often an indication that other memory is corrupt?
When I use it from a web project using the web server of Visual Studio 2005 Environment it runs fine, but I? cant use it in a IIS Web. It is not a programming error, all methods invoked returns this error when are called from IIS Web site.
What do I have to configure to allow my web site to call unmanaged dlls?
I really need help.
Thanks a lot.
Marcelo
------------------------------------------------------------------------
I have an asp.net/C# application that uses third party dll to get some system information (get a unique machine id).
It works well on XP, 2000 and 2003, but when tried on Vista, IIS hangs when accessing dll methods (IIS Worker Process stopped working and was closed).
I tried different approaches to solve this problem but I'm stuck without anymore ideas to try.
I know asp.net is finding the dll (if I rename it, it shows an error of file not found), so I think it has to do with security.
I tried to impersonate (in web.config file), giving full access on file properties to IIS_IUSRS group, .NET Trust level to full, moving project to inetpub\wwwroot folder and some other tries.
If I use the dll on a winform application, it works great.
I've done a little dll on vc6 and it also works great on aspnet.
------------------------------------------------------------------------
Hello,
is it possible to use DllImport to call a DLL in ASP.NET ?
Or is it necessarry that my DLL has to be copied into \System32 ?
My DLL is a native C++ 7.1 DLL (not managed, no COM, no regsvr32) and uses
Assembler to make some math in SSE.
The result is given out as an Int.
Using a C# console app (code below) it work fine & fast.
However, once again ASP.NET refuses to execute my inline ASP.NET code (Error Code)
Even the tip out of G00gle to use the full path in DllImport wasn't a
solution.
I've check this on my ISPs websapce and on my local IIS6.
Is the reason for this problem the general extremely over-limited runtime
permission of ASP.NET ?
Can ASP.NET or IIS6 be told to allow DllImport calls to my DLL ?
My ISP is ready to make configuration changes for my case but don't know a
solution, too.
Thx for your opinions !
------------------------------------------------------------------------
Hello everyone,
I developed my C# ASP.NET (Framework 1.1) application on my Windows XP Pro computer. I was able to use the follwoing to import a DLL and use its functionality with no problems. I was able to run the application on my computer without getting the "Unable to load DLL (client.dll)" message.
However when I uploaded the application to our Windows Server 2003 IIS server it gave me the following message:
Unable to load DLL (client.dll)
The calls I'm using are as follows: (I have three of these...but I'll only show one here to save space)
using System.Runtime.InteropServices;
[DllImport("client.dll")]
public static extern int MP4_ClientGetServerChanNum([MarshalAs(UnmanagedType.LPStr)] string m_sIPAddress);
------------------------------------------------------------------------
I want to import a dll in asp.net, and I have a major problem.
that this dll works fine in a windows application written in vb.net, the dll importation works just fine.
..........
Public Declare Function GMW_SetSQLUserPass Lib "GM6S32.dll" (ByVal sUserName As string, ByVal sPassword As String) As Integer
intres = GMW_SetSQLUserPass(SQLUserName, SQLPassword)
.............
But, when I run the same code in asp.net or even when I make a webservice of the functionallity I don't get anything back, nothing, not even an error.
Thanks
------------------------------------------------------------------------
I've created my web project on my localhost, all is working fine. But when I put them on my hosting (of course it support .NET Framework 1.1), I get this error as follow:
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
plz help me to solve this problem.
I complie my class (*.cs) into bin\*.dll by using csc command. So can these dll run on my hosting ??? all of dll files in bin folder can run on both of my localhost and my hosting without registing on the server ???
------------------------------------------------------------------------
As our application design requires us to use one of the validation API engine which was written on C(so basically all I have is a dll) and I tested calling the functions using small windows application using DllImport for each functions and it works without any problem. But when I try to use the same Dll in my asp.net web application, it hangs with the first call. I tried giving the dll path as a hardcoded path like C:\validation.dll in my dllimport funciton call but did not help.
I am wondering it has something to do with ASPNET account security. So I gave full control for ASPNET account for my application directory and still my application hangs.
Anybody faced this earlier?
------------------------------------------------------------------------
hi group,
i have a dll called dmcl40.dll written in c language. now i am using this from a winforms application using something like this
[DllImport(@"D:\123\456\bin\DMCL40.DLL")]
private static extern bool dmAPIInit();
Things work perfectly fine. but when i use the same code from webforms, the function call fails with no exception raised. do i have to do something else for this?
regards,
tpb
------------------------------------------------------------------------
When I compile and run my simple site under Visual Studio it works just find. However, when I set it up under IIS I get the errors. Please check the code and Error below. Is there something I need to configure on IIS to properly do DLLImport?
------------------------------------------------------------------------