Welcome to today’s post.
I will be discussing to deploy your .NET Core Application to an IIS server.
To deploy a .NET Core Web application from Visual Studio 2017 start by opening the solution.
Then right-click, and select Publish… The following dialog will display:
Click on the New Profile… button.
The following dialog will display:
Select the IIS, FTP, etc. option.
Click on Create Profile.
In the next screen, the Connection dialog, enter the server (if on the same machine, localhost), site name and destination URL. Attempt to validate the web site connection.
If you get this error:
Run msdeploy elevated
Then you will need to cancel the Connection and Publish dialogs, close VS 2017 and re-open VS 2017 under Administrator access.
Now proceed to re-action publish. Following successful connection validation, the dialog should look like this:
Save the connection.
Proceed to the Settings screen:
In this screen, if your application has no database, then the connection string section can be unchecked, else it can be overridden with a database connection string that will work within IIS.
Note: If you use the same SQL Express that was used during development, trusted database connection strings for SQL Express do not work under IIS as they will need to be specified under an account that has access to the database and a database server that is accessible to IIS.
After the settings is saved, the following publish summary details will show:
The profile can be renamed from the generic profile name:
Next, click Publish.
The application will commence building:
Once the build the deployment has completed, open IIS and inspect the site and web applications to see if the deployment was successful:
Browse to the web site.
If all goes smoothly, the home page should display without problems:
That’s all for today’s post.
I hope you found this post informative and useful.
In a future post I will show how to setup your Visual Studio 2017 environment for IIS debugging.