asp.net.netasp.net-coreftppublishing

Error code 550 when publishing .NET Core 3.1 app through FTP


I have a .NET Core 3.1 app (api) that i'm publishing online and I'm using the publish method FTP in Visual Studio. It works perfectly but when I try to publish again after coding, I always get these errors:

This goes on for quite some time on all the dll's in my project. The only way I can publish after working, is full resetting my PC, remove all bin and obj folders in my projects that have to get published, open VS and publish before doing anything else.

I suspect this has to do with VS still using the dll's somewhere/somehow while i'm trying to publish.

I have tried locating processes in task manager but haven't seen anything unusual/problematic that could cause this.

Any help regarding this would be greatly appreciated, because I like to update my API for every route I write to test on the deployed version aswell, but it's quite the hassle this way...

Thanks!


Solution

  • I don't think it's your pc. Error 550 is an FTP error. What I think is happening here is that when you publish your website via FTP and open your website in your browser what you actually do is run your application on your server.

    When your application is running you can not modify the DLLs that are in use.

    So why restarting your pc will fix the problem? It is because these hosting providers have a configuration that if no one requests a website for a while then kill the application. it is because of saving memory and cpu.

    So when you restart your pc and delete bin and obj folders and rebuild your project that takes time and because in the meantime there is no request sent to your website your application is killed and now you can update your website with FTP again.

    To test this scenario simply close your browsers and do not open your website for a while like half an hour and then try to update your website via FTP. Or you can restart your PC and delete bin and obj folders but before pushing your files with FTP open your site in a browser. This must run your application and cause the 550 error again.