简体   繁体   English

通过 Visual Studio 发布 Web 服务时删除锁定文件时出错

[英]Error deleting locked file on publishing a webservice over Visual Studio

I'd like to publish a webservice in visual studio 2022 over the context function "Publish..." to a remote server folder, on which inte.net information services (iis) is running.我想在 visual studio 2022 中通过上下文 function“发布...”将 Web 服务发布到正在运行 inte.net 信息服务 (iis) 的远程服务器文件夹。

If visual studio 2022 published the webservice to the remote server folder the first time, there are no errors.如果visual studio 2022第一次发布webservice到remote server文件夹,没有报错。 But when i publish the webservice a second or a third time after a few days i got the following error.但是,当我在几天后第二次或第三次发布网络服务时,出现以下错误。

...
>*Error deleting file 'bin'.  Unable to delete 'bin'.  Access denied*
...

I have checked the folder and found a file 'example.dll' in the folder 'bin' from my webservice, which can not be deleted.我已经检查了该文件夹,并在我的网络服务的“bin”文件夹中找到了一个文件“example.dll”,该文件无法删除。

The not deletable file 'example.dll' is used by w3wp.exe an iis worker process.不可删除的文件“example.dll”被 w3wp.exe iis 工作进程使用。

I have to restart in iis the application pool of the webservice to unlock the file 'example.dll'.我必须在 iis 中重新启动 Web 服务的应用程序池以解锁文件“example.dll”。

But the problem is, that other webservice are running in the application pool and this leads to errors by the other webservices.但问题是,其他 web 服务正在应用程序池中运行,这会导致其他 web 服务出错。

Is there a other way to unlock or to delete the file on publishing the webservice over visual studio 2022?在通过 visual studio 2022 发布网络服务时,还有其他方法可以解锁或删除文件吗?

I'm sure you could write a script or something to auto recycle the app pool on publish, but most of the time if the service is in use you will need to recycle/stop the pool to release that dll.我确定您可以编写脚本或其他东西来在发布时自动回收应用程序池,但大多数情况下,如果该服务正在使用中,您将需要回收/停止池以释放 dll。

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

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