3

I have a problem deploying a .net core application via FTP which is hosted on IIS.

The main DLLs (core application) that I want to update just wont upload, FTP just gives me a generic permission error message. I think the reason is because they are in use because then I stop the application pool, upload and restart it works just fine.

But this isn't really a solution, are there any other methods of publishing that will alleviate this problem?

Edit:

"open for write: failure"

Is the only error I'm getting. I can't find anything online and the only solution I have is restart the app pool.

Richard Vanbergen
  • 1,904
  • 16
  • 29

1 Answers1

3

I found an answer and I figured it should be here for future Googling.

The issue is as I first expected IIS proxies the request to kestrel and that means the process is in use as far as Windows is concerned. There are three solutions.

The Good Solution

Have two (or more) VMs on azure behind a load balancer. Have a script which turns off the sites one at a time, does what it needs to do and turns them back on. Do this right and no downtime!

Intermission

Before I talk about the other solutions a little explanation. I have not been working with .NET for a long time but apparently there was this thing you could do where you add a app_offline.htm and it will temporarily take down the site for you.

In the context of IIS and .Net Core it also releases the process, which is really useful as it solves my problem! Although I had to visit the web page first for it to take effect, unless I'm mistaken.

The Bad Solution

Use an automated script to rename _app_offline.htm to app_offline.htm. Do the upgrade and then revert that change. Takes your site down, kind of ugly but scripting is always better than...

The Ugly Solution

You only have access to FTP, no remote admin or proper deployment process because... reasons.

Upload an app_offline.htm, upload as little as possible and hope it doesn't break anything before deleting or renaming app_offline.htm.

Also you would have to perform any DB migrations by using EnableAutomaticMigrations = true because you have no server access or scripting methods.

Richard Vanbergen
  • 1,904
  • 16
  • 29