Search code examples
azureazure-web-app-service.net-5webdeploy

Web Deploy experienced a connection problem with the server and had to terminate the connection - Azure App Service


While trying to deploy a .NET 5 web app to Azure App Service from Visual Studio, I'm hit with this unhelpful error window message:

Publish has encountered an error. Build failed. Check the Output window for more details.

A diagnostic log has been written to the following location: "C:\Users\SomeUser\AppData\Local\Temp\tmp6F34.tmp"

The output window has the following error:

Web Deploy experienced a connection problem with the server and had to terminate the connection. Contact your server administrator if the problem persists. Learn more at: https://go.microsoft.com/fwlink/?LinkId=221672#ERROR_CONNECTION_TERMINATED. Unexpected end of file has occurred. The following elements are not closed: results. Line 1, position 550.

I tried all the steps outlined here in the MS docs page, and all the other related SO answers, but still can't make this work.


Solution

  • After a lot of trials and errors with the Publish steps, I finally figured this out.

    This is what the final step needed to look like:

    Essentially, checking the 'Run from package file' checkbox fixed the issue for me.

    Finally, the Publish window looks like this: