0

I'd like to publish a webservice in visual studio 2022 over the context function "Publish..." to a remote server folder, on which internet information services (iis) is running.

If visual studio 2022 published the webservice to the remote server folder the first time, there are no errors. 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.

The not deletable file 'example.dll' is used by w3wp.exe an iis worker process.

I have to restart in iis the application pool of the webservice to unlock the file 'example.dll'.

But the problem is, that other webservice are running in the application pool and this leads to errors by the other webservices.

Is there a other way to unlock or to delete the file on publishing the webservice over visual studio 2022?

1 Answers1

0

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.

JBatstone
  • 167
  • 7
  • Hello @JBatstone, i want to prevent to restart the application pool, because this lead to problems to other running webservices on this application pool. – Viktor Künstler Apr 21 '22 at 17:53
  • This answer selected here might have the info you need: https://stackoverflow.com/questions/9658849/iis-app-pool-restart-and-asp-net – JBatstone Apr 21 '22 at 17:56
  • I realize that there an context menu option in iis for recycling the application pool, which possibly would unlock the file. I will test it on the next error. – Viktor Künstler Apr 22 '22 at 12:14
  • It does, but you have to time it right. And occasionally the service is greedy and holds onto it. – JBatstone Apr 22 '22 at 23:10