简体   繁体   English

在asp.net Web应用程序中使用后无法删除托管dll

[英]Unable to delete managed dll after using it in an asp.net web application

I am using NHunspell in an ASP.net web application. 我在ASP.net Web应用程序中使用NHunspell。 NHunspell wraps either Hunspellx86.dll or Hunspellx64.dll, both of which are unmanaged dlls. NHunspell包装了Hunspellx86.dll或Hunspellx64.dll,这两个都是非托管的dll。

The problem is this: when I dispose of my NHunspell object (which calls FreeLibrary from kernel32.dll ), it seems that IIS is still hanging on to it - as evidenced by both windbg and tasklist /m . 问题是这样的:当我处理我的NHunspell对象(从kernel32.dll调用FreeLibrary )时,似乎IIS仍然挂在它上面 - 正如windbg和tasklist /m所证明的那样。 This is problematic if, say, I try to replace that dll using an automated build process, or run an installer to update my web application: everything fails because that dll is in use. 例如,如果我尝试使用自动构建过程替换该dll,或者运行安装程序来更新我的Web应用程序,则会出现问题:因为dll正在使用中,所有内容都会失败。

I'm wondering if anyone can confirm my suspicions that it is, in fact, IIS that is caching it? 我想知道是否有人可以证实我的怀疑,事实上,IIS正在缓存它? Also, why can I delete managed dlls right out from under IIS (even when tasklist reports those dlls as used by IIS)? 另外,为什么我可以从IIS下删除托管dll(即使tasklist报告IIS使用的那些dll)?

Finally, I'm looking for suggestions on what to do about actually being able to delete this dll for automated builds/installs? 最后,我正在寻找有关如何实际删除此dll以进行自动构建/安装的建议?

Thanks very much! 非常感谢!

If you are running on IIS 6 or greater, you could just stop the specific application pool. 如果您在IIS 6或更高版本上运行,则可以停止特定的应用程序池。 However, what is the exact build command that is not overwriting the file? 但是,什么是不覆盖文件的确切构建命令? We use a TFS build automation step that copies our files out to a test server running IIS which has all the dlls in use and it is no problem. 我们使用TFS构建自动化步骤将我们的文件复制到运行IIS的测试服务器,该服务器具有所有正在使用的dll并且没有问题。 What I can't confirm is how it does that, I suspect it is using XCOPY but I can't be sure. 我无法确认它是如何做到的,我怀疑它是使用XCOPY,但我不能确定。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM