Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dotnet Core publish to IIS from Mac

I want to publish my dotnet core app to IIS from mac. I use VS code for code writing and Dotnet Core 1.1 for publishing to local directory. (for example: bin/release/publish). There are compiled my files, ready to copy to IIS. On my IIS I currently have installed web deploy 3.6 and this is my VPS machine. Is there elegant way, how to copy files? The another way is using docker, but in this case I have the same problem. Generated docker file with docker publisher tool and I need to copy from mac os.

Thank you for your time.

like image 275
Petr Tomášek Avatar asked Jan 10 '17 18:01

Petr Tomášek


People also ask

How do I use IIS on Mac?

IIS doesn't run on Mac, so I guess you should try Apache, and then install module "mod_mono". Or if that gets too hairy, just use the standalone mono web server called XSP. Or run FastCGI, or nginx.

Can I use .NET Core on Mac?

Net Core 5.0 has been deployed on Window, MacOs and Linux.

How to publish ASP core web application to IIs?

Publish ASP .NET Core Web Application to IIS – 1 Selecting Folder option and then clicking on Next would open next screen, which asks for the folder location, where the site should be published. This path can be either from the same machine or it can be some shared path on the network.

How do I deploy a DotNet application to IIs?

1 Configure your .NET Core project. When trying to deploy on an IIS Server, make sure you already configure your Startup.cs and Program.cs accordingly. 2 Publish your .NET Core application. Get into the directory where you want to put the application. Get inside the newly formed folder and run the dotnet publish command. 3 Run your .NET Core on IIS

How to publish an app to a folder in IIS?

The app is published to a folder. The folder's contents are moved to the IIS site's folder (the Physical path to the site in IIS Manager). Right-click on the project in Solution Explorer and select Publish. In the Pick a publish target dialog, select the Folder publish option. Set the Folder or File Share path.

What is DotNet publish and how does it work?

dotnet publish - Publishes the application and its dependencies to a folder for deployment to a hosting system. dotnet publish compiles the application, reads through its dependencies specified in the project file, and publishes the resulting set of files to a directory.


2 Answers

From a terminal window navigate to the folder where your .csproj file is. From there run 'dotnet publish -c release'. A folder called publish will be created in bin/Release/netcoreappX.X. You can copy those files to the appropriate directory on your server. If you need help setting up IIS, follow the link below.

https://learn.microsoft.com/en-us/aspnet/core/publishing/iis

You can also run 'dotnet publish -h' to see all of the different arguments you can pass to the publish command.

like image 116
Andrew Avatar answered Nov 12 '22 18:11

Andrew


Web Deploy (msdeploy.exe) seems to work in Mono, at least in WSL (Ubuntu 18.04). The tricky part is to extract the msi package somehow, which you can do easily on a Windows machine (you'll find the files in C:\Program Files\IIS\Microsoft Web Deploy V3).

Once you install Mono and obtain msdeploy.exe, just call the command, e.g.

mono msdeploy.exe -verb:sync -source:contentPath=/mnt/c/Data -dest:contentPath=test,ComputerName=https://example.com:8172/msdeploy.axd,UserName=WDeployAdmin,Password=PASSWORD,IncludeAcls=False,AuthType=Basic -enableRule:AppOffline -enableRule:DoNotDeleteRule -verbose -allowUntrusted:true

This lets you sync/copy the contents of /mnt/c/Data with the test web site in IIS on example.com with Web Deploy enabled.

like image 45
Yegor Avatar answered Nov 12 '22 16:11

Yegor