We have an ASP.NET web application, which is a C# DLL, that references a C++/CLI DLL, that links against some native static libs.
When we edit the web.config file, the appdomain unloads itself as expected, however at the next web request the application crashes with some access violation exception from our native code.
Further investigation has shown that as soon when the app domain "unloads", the w3wp.exe process actually lives on, and it only unloads our C# DLL (and not our C++/CLI DLL). This is probably why we're getting these exceptions.
How can we 开发者_C百科stop this madness? Can we get ASP.NET to completely recycle the w3wp process upon web.config update? Can we get ASP.NET to actually unload all of our DLLs if w3wp lives on?
Create a wrapper assembly and manually GetModuleHandle + FreeLibrary when the assembly / appDomain is recycled.
It would cause problems if you create Application Domains manually or use one Application Pool in IIS for multiple applications, though.
Couldn't find any solution better than calling Environment.Exit(0)
at the end of Application_End
.
精彩评论