从Visual Studio向Linux发布.net核心MVC [英] Publish .net core MVC from visual studio to linux

查看:105
本文介绍了从Visual Studio向Linux发布.net核心MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在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?

推荐答案

您可以在ASP.NET CORE文档-

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:

  1. 使用dotnet publish命令发布应用.
  2. 使用Powershell压缩所有内容.
  3. 使用pscp将zip复制到Linux机器- https://the.earth.li/~sgtatham/putty/0.60/htmldoc/Chapter5.html
  4. 使用Windows Bash连接到Linux计算机(您需要Windows 10周年更新才能使用此功能).
  5. 在Linux机器上调用unzip命令-需要首先在该机器上安装.
  6. 在Linux计算机上重新启动超级用户服务.
  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.

这篇关于从Visual Studio向Linux发布.net核心MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆