Prevent loading a specific DLL in IIS

I get a general error:

Failed to load file or assembly "..." or one of its dependencies. The specified module was not found.

The problem is that this DLL refers to unmanaged DLLs so that it can never load normally. I just want IIS to ignore this file.

I play with the <remove assembly> in the web.config file, but with no luck.

Any suggestions on how I can prevent my single dll from loading?

+4
source share
2 answers

Although I could not figure out how to limit a particular assembly, I was able to complete it by deleting all the assemblies and adding the ones I need that I need. change web.config file to:

 <system.web> <compilation targetFramework="4.0"> <assemblies> <remove assembly="*"/> <add assembly="example.dll"/> </assemblies> </compilation> </system.web> 
+2
source

.Net runtime does not load assemblies for entertainment. He does this only when necessary, i.e. You are actively using the class / methods from this assembly. You can even reference assemblies that are missing if the code that uses them does not execute.

Therefore, preventing the assembly from loading will not make your application work - that is, remove the assembly and see how your application crashes due to lack of dependency.

If you yourself download the assemblies yourself (for example, Assembly.Load), than you need to figure out how to skip such assemblies ...

+1
source

All Articles