ASP.NET 是否将所有程序集从 bin 加载到 AppDomain 中?
ASP.NET 是否将所有程序集从 bin 文件夹加载到 AppDomain 中?
我之所以问这个问题是因为我正在尝试寻找接口的特定实现,并且它似乎在没有显式 Assembly.Load(...)
的情况下解决了它们。
Does ASP.NET load all assemblies into the AppDomain from the bin folder?
Why I ask is because I'm trying to look for specific implementations of an interface and it seems to be resolving them without an explicit Assembly.Load(...)
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
除非它们被引用(静态或动态),否则它不会加载它们。但 Bin 文件夹被视为探测路径的一部分,因此它将习惯于尝试加载程序集。
It will not load them unless they are referenced (either statically or dynamically). But the Bin folder is considered part of the probing path, so it will get used to try to load Assemblies.
我认为它确实通过 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() 加载了所有这些。我在分析堆栈跟踪中得到了这一点,但找不到太多相关文档。
SO 们在这里讨论控制它:如何阻止 ASP.NET 在首次加载时从 bin 加载所有程序集
I think it does load them all, via System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory(). I get that in profiling stack traces but can't find much documentation of it.
Fellow SO'ers discuss controlling it here though: How to stop ASP.NET from loading all assemblies from bin on first load