Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to not get "ERROR_FILE_IN_USE " error when deploying a ASP.NET Core website using FTP/shared folder?

I have an ASP.NET Core RTM Web Application that targets .net framework 4.52

In my project.json

"frameworks": {
    "net452": {}
  },

When I publish it to an folder it creates a MyWebApplication.exe and when I access the app in my browser the exe is run.

I need to publish the website to a web server that has Windows Server 2012 and IIS8

I have shared folder access via VPN to the website deploy directory.

The first time I publish the site to the folder it worked correctly. I access the website url and the site loads. However when I want to republish the website after making changes and copying over the files it tells me the MyWebApplication.exe is in use and the publish fails.

The only way I know how to resolve this is to before publishing to kill the MyWebApplication.exe in task manager on the web server. However since I only have access to that server through a shared directory this is not possible.

With ASP.NET 4 websites I don't have this problem.

With ASP.NET CORE RC1 I also didn't have the problem as it was using dnx though the HTTPPlatformHandler which allowed me to copy the site without having to kill the dnx.exe. I just had to touch the web.config and the site would restart.

My questions are:

  1. Is there a way to copy over/publish a new changed version of a site that had already been deployed (Either FTP or via shared folder access)?

  2. Is there a way to stop the website e.g. unload the MyWebApplication.exe from memory on the web server either via FTP or via shared folder access?

like image 665
dfmetro Avatar asked Aug 26 '16 14:08

dfmetro


1 Answers

The ERROR_FILE_IN_USE error is an open issue on github

Simply delete the web.config the publish directory before publishing.

Without a web.config the site will automatically stop and unload the files from memory and will stop anyone from loading the site into memory again accessing the URL.

Another workaround is to copy an app_offline.htm to your publish directory which should work as well. Link

like image 184
devfric Avatar answered Sep 21 '22 11:09

devfric