Publishing an ASP.NET Core Web Application to IIS using Visual Studio 2019

I’m a developer at heart, so I’m constantly keeping up with the latest technologies. currently I’m developing ‘Time and Bill’, an ASP.NET Core Web Application. The application is based on Microsoft .NET Core 5.0 (5.03 to be exact). Well, developing the application is one thing, the other thing is to publish the application on an IIS (internet information server). There are some more posts about this topic, you can find them by searching or using the tags.

Below are some errors and the solutions applied for them. The post is mainly for me, so that the next time i try i have a place to read how i solved all the problems i encountered the last time.

Failure I

Severity Code Description Project File Line Suppression State
Error Web deployment task failed. (Connected to the remote computer (“192.168.177.50”) using the specified process (“Web Management Service”), but could not verify the server’s certificate. If you trust the server, connect again and allow untrusted certificates. Learn more at: https://go.microsoft.com/fwlink/?LinkId=221672#ERROR_CERTIFICATE_VALIDATION_FAILED.)

Connected to the remote computer (“192.168.177.50”) using the specified process (“Web Management Service”), but could not verify the server’s certificate. If you trust the server, connect again and allow untrusted certificates. Learn more at: https://go.microsoft.com/fwlink/?LinkId=221672#ERROR_CERTIFICATE_VALIDATION_FAILED.
The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
The remote certificate is invalid according to the validation procedure. TimeAndBill 0

Solution

Adding <AllowUntrustedCertificate> Attribute to IISProfile.pubxml

Failure II

Severity Code Description Project File Line Suppression State
Error Web deployment task failed. (The SQL provider cannot run because of a missing dependency. Please make sure that Microsoft SQL Server Management Objects (Version 10 or higher) is installed. Learn more at: https://go.microsoft.com/fwlink/?LinkId=221672#ERROR_SMO_NEEDED_FOR_SQL_PROVIDER.) TimeAndBill

Solution

Using Web Platform Installer – at the time of the post the version is 5.1

In Web Platform Installer 5.1 -> Install SQL Server Shared Management Objects (2012 on Vista and up) or (2010 on XP or 2003 server)

well, I don’t know if it’s a good idea to install a software that was released in 2012. But what can you do, Microsoft has pulled all the resources/man power for the cloud, there will probably be a more current version of this software component in operation. eat or die, we say in German.

Failure III

This was actually a real pain in the .. you know.

Severity Code Description Project File Line Suppression State
Error Web deployment task failed. (Could not connect to the remote computer (“192.168.177.50”) using the specified process (“Web Management Service”) because the server did not respond. Make sure that the process (“Web Management Service”) is started on the remote computer. Learn more at: https://go.microsoft.com/fwlink/?LinkId=221672#ERROR_COULD_NOT_CONNECT_TO_REMOTESVC.)
Make sure the site that you are deploying to is a valid site on the destination server. If the issue is not resolved, please contact your server administrator.
Error details:
Could not connect to the remote computer (“192.168.177.50”) using the specified process (“Web Management Service”) because the server did not respond. Make sure that the process (“Web Management Service”) is started on the remote computer. Learn more at: https://go.microsoft.com/fwlink/?LinkId=221672#ERROR_COULD_NOT_CONNECT_TO_REMOTESVC.
The remote server returned an error: (550). TimeAndBill 0

If you follow the mentioned link you get:

ERROR_COULD_NOT_CONNECT_TO_REMOTESVC

Diagnosis: Web Deploy cannot connect to the remote service.

Resolution: Ensure that:

  1. You can ping the remote machine
  2. That the msdepsvc or wmsvc service is started on the remote server.
  3. Your firewall is not blocking incoming connections of your ports on the destination. If you used the default installation, then it would be 80 for msdepsvc and 8172 for wmsvc.

To test 1 & 3 you can do in FlowPowerShell:

Test-NetConnection -ComputerName 192.168.177.50 -Port 8172

and for 2:

Get-Service wmsvc

so that wasn’t the problem.
i found this one: https://stackoverflow.com/questions/18739342/web-deploy-results-in-error-could-not-connect-to-remotesvc

https://stackoverflow.com/a/20478804/270085

and that solved the problem for the moment -> i had site name: TimeAndBill -> when i changed it, the web app got published.

Failure IV

HTTP Error 500.32 – Failed to load .NET Core host

Solution

In IIS -> Default Web Site -> Advanced Settings -> (General) Section -> Application Pool -> Choose DotNetCore as the App Pool

-> if you don’t have this option -> Create an App Pool named DotNetCore

in order to do that: In IIS -> Application Pools -> Add Application Pool

Once created the Application pool -> Advanced Settings -> Enable 32-Bit Applications -> True

Well, this shows how complicated publishing an asp.net core web app to an IIS is. As always, feel free to comment.