Visual Studio Publish / Web Deploy

Web deploy can be used to upload a site developed through Visual Studio to the web server.  Using web deploy can help avoid issues like missing assemblies that might occur when uploading a Visual Studio project via FTP.  Note that the steps below are for Visual Studio 2017.  Additional information relating to Deployment Mode in Core can be found at the bottom of the article.
 
 
Set up a publish profile
 
In Visual Studio, right click the project and select Publish from the menu.
 
 
 
 
Select Web Server (IIS) as the publish target then Next.
 
 
 
 
Select Web Deploy as the Specific Target then Next.




The web deploy connection settings required are
 
Server:  w##.winhost.com (replace "w##" with the Server Name from the Site Info pane; see below)
Site name:  the website's domain name
User name:  the FTP username
Password:  the FTP password
Destination URL:  optional and can be left blank; used for a redirection after the site is successfully deployed
 
If there is a database, click Next to set up the connection string.  If not, click Finish.
 
 
 
 
Site Info
 
The connection settings for Web Deploy can be reviewed at Winhost Control Panel > Sites > the applicable domain name > Site Info pane
 
 
 
 
Connection String
 
If a connection string is required for the deployed project, a Winhost database connection string can be found at Winhost Control Panel > Sites > the applicable domain name > MS SQL Manager > Manage (applicable database).  Note that the example Connection String does not contain the database password in plain text, so it will need to be updated after copying it to Visual Studio.  After adding the connection string, Save.
 
 
 
 
Publish
 
After saving the publish profile, the left pane in Visual Studio should update.  Click Publish to deploy the project to the web server.  If there is an error on publish, open a ticket with the Support Department and provide the error in case Web Management Service needs to be manually restarted.
 
 
 
 
Core Publish Settings

Deployment Mode for Core applications depends on the version being deployed.  To check if Framework-Dependent deployment is available for the selected version see https://support.winhost.com/kb/a1498/installed-_net-core-frameworks.aspx.   Self-Contained deployment should be used for any newer version until installed.

Target Runtime can be left Portable or set to win-x86.
 
 


Core Hosting Model defaults to InProcess for deployed apps.  If attempting to run more than one app from a single app pool, all Core apps will need to be changed to OutofProcess (case insensitive).  The hosting model can be changed by updating the .csproj file (left click on the Project name in Visual Studio) and add the following to the PropertyGroup:

<AspNetCoreHostingModel>OutofProcess</AspNetCoreHostingModel>