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)
public static extern int MP4_ClientGetServerChanNum([MarshalAs(UnmanagedType.LPStr)] string m_sIPAddress);
So since I've been getting the error "Unable to load DLL (client.dll)" on my Windows Server 2003 I've tried the following remedies with no luck: NOTHING BELOW WORKED FOR ME:
- Tried hard coding the path of the DLL into the DLLImport call
- Tried to add the DLL to the applications BIN directory
- Tried to add the DLL to the applications BIN directory AND point the path of the DllImport to the BIN directory
- Tried to set the permissions on the "client.dll" file so that my IIS user could execute it. I really thought this would do it but it didn't work.
- Added the "client.dll" file to my C:\Windows\System32; and C:\Windows; direcotries and set the permissions for the IIS user to execute them. I actually didn't try hard coding the path to the above windows directories ...will have to try that after this post.
- Tried to change my environment variables. Set PATH to where the application lives c:\Inetpub\wwwroot\WebApplication1
At this point I am desperate and would appreciate the help. I will offer 2000 points for this question if someone can help me. I'll settle that with the person who answers.
Any comments and/or points in the right direction are appreciated.