We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


Unable to load DLL (client.dll) - My ASP.NET 1.1 C# application having problems on 2003 but not on XP

VirtueTech asked
Medium Priority
Last Modified: 2008-01-09
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;

   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.

-- James
Watch Question


It seems client.dll is not a .net dll.

So first register the compoent in the client machine (2003) with regsvr32 command, if am right.

Hope this helps.

Is client.dll a regular DLL or a COM+ DLL?

If it is a regular Win32 DLL, you're using the right method. But it seems like it isn't.

If it is a COM+ DLL, you'd need to first run regsvr32.exe as surehtoday points out. Afterwards, you'd need to use tlbimp to generate a wrapper around the DLL. And after all this, you can call the classes in the DLL just as if it was made in .NET (I.e. you don't have to do the DllImport manually).
Check out these articles for more detailed instructions:


First off thanks for your replies. They are making me very optimistic that this will work. Excuse this newb, but I'm not sure if the DLL is WIN32 or COM+. Is there a simple way to find out?

I tried running "regsvr32" form command prompt like so:

C:\Inetpub\wwwroot\WebApplication1> regsvr32 "c:\Inetpub\wwwroot\WebApplication1\

I got this in return:
bin\hikclient.dll") failed - The specified module could not be found.

- I checked the permissions on the file...they look fine. The administrator is the owner and has privileges.
- The file does exist in that path

Any ideas what I'm doing wrong?


[DllImport("kernel32.dll", CharSet=CharSet.Auto)]
static extern IntPtr LoadLibrary(string lpFileName);

I run that in the beginning of my code. Is it the same thing that "regsvr32" is trying to do when I run it from command line?


Also...is it wrong to assume the DLL is a Win32 DLL because I was able to make it work on my Windows XP Pro development machine?
Hi Virtue,

The reason for your curent error may be, some dependency dlls may not available in the target machine.

try http://www.dependencywalker.com/ to check what are dlls referenced my your component.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


I love you. I mean I really love you. Thank you so much. I can't begin to explain how huge that was.

Upon opening the dll in "Dependancy Walker" it showed that it was looking for a DLL that came with the product. Little did I know they were dependant on each other.

I appreciate it so much. I'd really like to give you more points. Maybe a question just to give points?

Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.