从Visual Studio向Linux发布.net核心MVC [英] Publish .net core MVC from visual studio to linux
问题描述
我可以在Visual Studio中编辑.Net Core MVC应用程序并部署到Linux服务器(例如Ubuntu).
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?
推荐答案
You can check this page in the ASP.NET CORE documentation - https://docs.microsoft.com/en-us/aspnet/core/publishing/linuxproduction
也可以从Scott Hanselman的此博客文章中找到一个很好的例子- https://www .hanselman.com/blog/PublishingAnASPNETCoreWebsiteToACheapLinuxVMVM.aspx
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:
- 使用dotnet publish命令发布应用.
- 使用Powershell压缩所有内容.
- 使用pscp将zip复制到Linux机器- https://the.earth.li/~sgtatham/putty/0.60/htmldoc/Chapter5.html
- 使用Windows Bash连接到Linux计算机(您需要Windows 10周年更新才能使用此功能).
- 在Linux机器上调用unzip命令-需要首先在该机器上安装.
- 在Linux计算机上重新启动超级用户服务.
- Publishes the app using dotnet publish command.
- Zips everything using Powershell.
- Copies the zip to the Linux machine using pscp - https://the.earth.li/~sgtatham/putty/0.60/htmldoc/Chapter5.html
- Connects to the Linux machine using Windows Bash (you need Windows 10 Anniversary Update for this feature to be available).
- Calls the unzip command on the Linux machine - needs to be installed there first.
- Restarts the supervisor service on the Linux machine.
这篇关于从Visual Studio向Linux发布.net核心MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!