简体   繁体   English

IIS和ASP.NET锁定了我的PInvoke dll

[英]IIS and ASP.NET is locking my PInvoke dll

I have an ASP.NET MVC website that uses an internal dll for some PInvoke stuff. 我有一个ASP.NET MVC网站,该网站对某些PInvoke内容使用内部dll。 The dll is located in the /bin folder next to the other assemblies. 该dll位于/ bin文件夹中其他程序集旁边。 This works well, but if I want to replace the content of the /bin folder with the newest set of files by copying onto the existing files (this is on a test server) the PInvoke dll is locked/used by the w3wp.exe worker process and cannot be replaced except after you recycle the apppool or restart IIS. 效果很好,但是如果我想通过复制到现有文件(在测试服务器上)将/ bin文件夹的内容替换为最新文件集,则pInvoke dll被w3wp.exe工作人员锁定/使用进程,除非在回收apppool或重新启动IIS之后才能替换。

Is this standard behavior or can I somehow instruct the ASP.NET runtime to take a shadow copy of the PInvoke dll similar to the regular assemblies? 这是标准行为还是可以以某种方式指示ASP.NET运行时获取类似于常规程序集的PInvoke dll的卷影副本?

AFAIK, if the IIS has an handle of the DLL, you won't be able to replace the DLL. AFAIK,如果IIS具有DLL的句柄,则将无法替换DLL。

You mentioned APPPool Recycle, and IIS Restart... 您提到APPPool回收和IIS重新启动...

I guess you may not have used touching your web.config file. 我猜您可能没有用过触摸web.config文件。 I mean, open your web.config in notepad, make a change [like add a space and remove it] and save the file. 我的意思是,在记事本中打开您的web.config,进行更改(例如添加一个空格并删除它)并保存文件。 This will recycle your application domain and hence the assembly reference should ideally be released [unless it is a shared assembly]. 这将回收您的应用程序域,因此理想情况下应释放程序集引用(除非它是共享程序集)。

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

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