0

We have service which is running on IIS app pool, for our scenario we started consuming a library (not owned by us), library has few dlls and some config and binary files which needs to be loaded during runtime. We are bin placing all dlls and dependent model files to web app bin folder. Found that during runtime due to shadow copy enabled, dlls are getting copied to C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files but not copying any of dependent config and model files which is causing issue at run time.

Anyone know how we can force dependency to also get copied or any other way to resolve this issue?

Checked other thread as well and suggestion was disable shadow copy using below settings but I want to avoid this.

<hostingEnvironment shadowCopyBinAssemblies="false" />
Nikhil
  • 182
  • 1
  • 1
  • 15
  • ASP.NET runtime only considers `web.config` valid configuration files to load automatically, so to load `*.dll.config` you need to write explicitly in code, https://stackoverflow.com/questions/62351873/how-can-i-load-a-dll-config-using-configurationmanager – Lex Li Jun 12 '22 at 17:02
  • is this a asp.net web site, or web application? If web applcation, then setting a reference to the libraries(s) in question will automatic copy the .dlls to bin output folder. If this is a web site, then of course you have to place the .dlls in the bin folder. so with a reference to those .dll's, then at build time, they should be copied to the output folder (bin) for you. However, this would assume a web application project. – Albert D. Kallal Jun 12 '22 at 18:20
  • @LexLi not only I need to load config but there is another dependent binary need to be loaded, will that will also work? Moreover loading dependent config and binary code present in external library dll which I don't have control :( – Nikhil Jun 13 '22 at 03:23
  • @AlbertD.Kallal All dependent dlls and config present in bin folder issue is with shadow copying to C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files – Nikhil Jun 13 '22 at 03:23
  • But that copying is only for visual studio. Production I don't believe does that kind of copy. If you deploy as web application, then you can even choose to merge all dlls into one. If you deploy as web site, then DLLs copy to bin. I find references thus better with web app vs web site. But was not aware of shadow copy when deployment is web app. But deployment as web site - I could be wrong. – Albert D. Kallal Jun 13 '22 at 03:34
  • Production system does copy like this only to avoid any down time, see this https://learn.microsoft.com/en-us/dotnet/framework/app-domains/shadow-copy-assemblies – Nikhil Jun 13 '22 at 05:37
  • It is difficult to reproduce your problem, I suggest you open a case via: https://support.microsoft.com. – samwu Jun 13 '22 at 09:52

0 Answers0