问题
I try to run an ASPX page hosted on a Windows Server 2008 x86 through IIS 7.0, with .NET 4.0. I added an application, app1
, to the Default Web Site
of IIS, mapped to dir C:\toto\app1
which contains the Web.config
file.
The error I have is:
Could not load file or assembly 'xxx.dll' or one of its dependencies, etc
and xxx.dll
is a .NET DLL that wraps native C++ DLLs (they are the dependencies that fail to be loaded), all of them are located in C:\toto\app1\bin
. I tried to modify the PATH env variable so that it contained the bin
directory (yes, I know it's bad :-) ), but this did not work anyway.
I guess there should be something at IIS application level, but I could not see what... Could you please help ?
Many thanks !
EDIT: copying the native DLLs in C:\windows\system32
actually works, but it's not a pleasant solution at all...
回答1:
If its not GACd (which it doesn't appear to be), the simple answer is:
You need the external DLL to be in the bin\ directory of the application.
If you have it as a reference in VS2010, select it, go to properties, and set the CopyLocal value to True. Rebuild the application. This should cause that DLL to copy out to the bin and your app can reference without any other work.
回答2:
Well, finally managed to make it work by copying the DLLs into windows\system32
directory (no idea why it did not wotk the 1st time, probably an error of mine...). The application\bin
folders don't work, neither does the change of the PATH
variable.
If anyone knows a better solution (I don't find this one brilliant at all, that can cause DLLs collision and so on), I'd be glad to hear it !
回答3:
I think this will do the job.
Do this on the server.
Undo all the things you've done before doing this.
Go to START->RUN and type cmd
then run the following command regsvr32 "C:\yourfolder\idrskrn_net14.dll"
with the " included.
Enjoy!
回答4:
I have exactly the same problem. The dll are in the webapp/bin directory but aren't loaded. I managed to put them in the inetpub/bin and there it runs fine. However there must be a behaviour that allows loading module in the webapp bin directory. Don't know how to setup this.
回答5:
I have the same problem. If I browse the website locally on the server it works fine but when I browse it across the internet via the domain name it cannot find the DLL's that are in the bin folder of the site...
来源:https://stackoverflow.com/questions/4829498/iis-7-0-windows-server-2008-dll-not-found-in-asp-net-application