0

Using dotnet publish, how do I deploy a dotnet core web application to a IIS server hosted remotely? What is the best way to do that?

I am setting up Jenkins for CICD for this app and need this process to be part of this.

Dave M
  • 4,494
  • 21
  • 30
  • 30
Krunal
  • 251
  • 1
  • 4
  • 15

1 Answers1

0

I think what you are looking for is MS Web Deploy. This is a Windows tool, that can perform remote deployments to IIS using a CLI command, making it easy to integrate into tools like Bamboo or Jenkins.

In order to use this, you'll need to have 2 services setup and installed on the IIS server.

  • Web Management Service
  • Web Deployment Agent Service

Once those services are setup and running, you can run the msdeploy.exe (C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe) that comes with MS Web Deploy to execute a application deployment. This can be done from the same server, or from a remote server.

Example:

msdeploy.exe -verb:sync
     -source:iisApp="$appPath\web"
     -dest:iisApp='$SiteName',wmsvc="$IIS-Server-Name",UserName='$user',Password='$password',AuthType='Basic',skipAppCreation=true
     -enableRule:AppOffline
     -allowUntrusted:true
  • Though not supported by Microsoft, it is possible to run Web Deploy on non-Windows platform via Mono. – Lex Li Apr 24 '22 at 02:18
  • That is good to know. How do you go about installing it on a non-windows system for running with mono? Wine? – MeemicMan Apr 25 '22 at 14:21
  • 1. Install Mono on that machine (Linux or macOS). 2. Copy msdeploy.exe (and its dependencies) from your Windows machine to that machine. 3. Run `mono msdeploy.exe` with the necessary parameters. This should enable certain features (but probably not all). – Lex Li Apr 25 '22 at 15:01
  • This seems like a good use case for a Docker container. – MeemicMan Apr 26 '22 at 18:02