Publish .net core MVC from visual studio to linux

心不动则不痛 提交于 2019-12-06 00:30:14

问题


Can I edit a .Net Core MVC aplication in Visual Studio and deploy to Linux server (e.g. Ubuntu).

Are there any tutorials for this problem?


回答1:


You can check this page in the ASP.NET CORE documentation - https://docs.microsoft.com/en-us/aspnet/core/publishing/linuxproduction

A good example can also be found in this blog post from Scott Hanselman - https://www.hanselman.com/blog/PublishingAnASPNETCoreWebsiteToACheapLinuxVMHost.aspx

I currently use my own batch script to deploy which follows these steps:

  1. Publishes the app using dotnet publish command.
  2. Zips everything using Powershell.
  3. Copies the zip to the Linux machine using pscp - https://the.earth.li/~sgtatham/putty/0.60/htmldoc/Chapter5.html
  4. Connects to the Linux machine using Windows Bash (you need Windows 10 Anniversary Update for this feature to be available).
  5. Calls the unzip command on the Linux machine - needs to be installed there first.
  6. Restarts the supervisor service on the Linux machine.



回答2:


I do not know how your can deploy from Visual Studio to Ubuntu server, but if you have access to the server (for instance with SSH) you can simply pull your code from a Git's repository, then compile, publish and run.



来源:https://stackoverflow.com/questions/42254478/publish-net-core-mvc-from-visual-studio-to-linux

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!