How to Fix Publishing Error ASP.NET Core Using Visual Studio 2019 – Windows ASP.NET Core Hosting 2024 | Review and Comparison

In this article, I will show you few errors that you can find when deploying your ASP.NET Core using WebDeploy. FYI, I’m using ASPHostPortal shared hosting services to deploy my .net core.

Below are some errors that you can find and the solutions applied for them

Error 1 – Could not verify the server’s certificate

Severity Code Description Project File Line Suppression State
Error Web deployment task failed. (Connected to the remote computer (“xxx.xxx.xxx.xxx”) 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

Error 2 – The SQL provider cannot run because of a missing dependency

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, please make sure you install SQL Server Shared Management Objects.

Error 3 – “Web Management Service”) because the server did not respond

Severity Code Description Project File Line Suppression State
Error Web deployment task failed. (Could not connect to the remote computer (“xxx.xxx.xxx.xxx”) 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 (“xxx.xxx.xxx.xxx”) 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

If still not fix the issue, please double check your WebDeploy settings. Please make sure you are using correct details (Server, Site Name, Username, Password).

Error 4 – HTTP Error 500.32 – Failed to load .NET Core host

The following is the solution to fix this error:

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

Conclusion

I have explained 4 error that you might encounter when using WebDeploy publishing. Maybe you have other errors, you can always comment below and we hope we can fix this issue together.