首先下载 对应的SDK 和runtime

https://www.microsoft.com/net/core#linuxubuntu           ---------当前为 1.1 稳定版本

2.0 预览版本下载地址:

https://www.microsoft.com/net/core/preview#linuxubuntu

---安装vs 2017的用户 除外

然后 下载 vscode

然后下载 yeoman 这个模板生成工具 进行项目的架子生成
https://docs.microsoft.com/en-us/aspnet/core/client-side/yeoman

安装node.js
C:\nodejs\

在 powershell 中执行下面的命令 安装 bower ,一个js css 脚本管理工具 Bower — a package manager for the web
npm install -g yo bower

然后安装 asp.net core 模板
npm install -g generator-aspnet

The –g flag installs the generator globally, so that it can be used from any path.

--------------使用yoman 的模板生成 或者使用自带的模板生成项目---------
yo 生成: yo aspnet 比较的全面 但是比较旧 跟不上版本变化
或者自带命令:
dotnet new mvc --推荐使用,毕竟自家的东西,版本能及时跟随 sdk -runtime 版本

Creates a new project, configuration file, or solution based on the specified template.
dotnet new <TEMPLATE> [-lang|--language] [-n|--name] [-o|--output] [-all|--show-all] [-h|--help] [Template options]
dotnet new <TEMPLATE> [-l|--list]
dotnet new [-all|--show-all]
dotnet new [-h|--help]
https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-new

---------将程序 部署在 Linux  Ubuntu 上----------------------

dotnet build 编译
dotnet run 运行调试
dotnet publish 发布

查看进程:
1,ps -e 命令
用 kill -9 pid 命令,来绝杀

kill $(ps aux | grep 'MySite.dll' | awk '{print $2}') --指定的站点
kill $(ps aux | grep 'dotnet' | awk '{print $2}')--全部asp.net core

最好的方式是使用进程守护工具
supervisor
sudo apt-get install supervisor

I have decided to use supervisor to monitor and manage the process. Here is an excellent article on getting it set up.

It allows simple control over specific dotnet apps like this:
-----------重启站点----------
supervisorctl stop MyWebsiteName
supervisorctl start MyWebsiteName

-----------为进程守护 写配置文件----------
/etc/supervisor/conf.d/bookManage.conf

[program:bookManage]
command=/usr/bin/dotnet /home/chen/webroot/BookManage1.1/bin/Debug/netcoreapp2.0/publish/BookManage.dll
directory=/home/chen/webroot/BookManage1.1/bin/Debug/netcoreapp2.0/publish/
autostart=true
autorestart=true
stderr_logfile=/var/log/BookManage.err.log
stdout_logfile=/var/log/BookManage.out.log
environment=HOME=/var/www/,ASPNETCORE_ENVIRONMENT=Production
user=www-data
stopsignal=INT
stopasgroup=true
killasgroup=true

-----------------------关于进程守护 Supervisor的介绍-----------
重启进程守护 加载新建的配置
sudo service supervisor stop
sudo service supervisor start

Viewing logs

Supervisord logs messages about its own health and its subprocess' state changes to the activity log. The path to the activity log is configured via the logfile parameter in the configuration file.

sudo tail -f /var/log/supervisor/supervisord.log
You can redirect application logs (STDOUT and STERR) in the program section of your configuration file.

tail -f /var/log/hellomvc.out.log

https://serversforhackers.com/monitoring-processes-with-supervisord

------使用nginx 反向 实现 web 服务器上 端口映射------------
sudo apt-get install nginx

sudo service nginx start
server {
listen 80;
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}

-----------上面是基本的nginx 配置,实际应用中nginx 有很多可以配置的地方--------------

参考文献:
https://www.hanselman.com/blog/PublishingAnASPNETCoreWebsiteToACheapLinuxVMHost.aspx
https://github.com/aspnet/Docs/blob/e9c1419175c4dd7e152df3746ba1df5935aaafd5/aspnetcore/publishing/linuxproduction.md

使用Visual Studio Code创建第一个ASP.NET Core应用程序
http://www.cnblogs.com/mengnan/p/5574593.html
https://docs.microsoft.com/en-us/aspnet/core/client-side/yeoman

【asp.net Core 2.0 初步探索】的更多相关文章

  1. 探索ASP.NET Core 3.0系列一:新的项目文件、Program.cs和generic host

    前言:在这篇文章中我们来看看ASP.Net Core 3.0应用程序中一些基本的部分—— .csproj项目文件和Program.cs文件.我将会介绍它们从 ASP.NET Core 2.x 中的默认 ...

  2. [转]探索ASP.NET Core 3.0 系列

    这是该系列的第一篇文章:探索ASP.NET Core 3.0. 第1部分-探索新的项目文件Program.cs和通用主机(本文) 第2部分-比较ASP.NET Core 3.0模板之间的Startup ...

  3. 探索 ASP.Net Core 3.0系列五:引入IHostLifetime并弄清Generic Host启动交互

    前言:在本文中,我将介绍如何在通用主机之上重新构建ASP.NET Core 3.0,以及由此带来的一些好处. 同时也展示了3.0中引入新的抽象类IHostLifetime,并描述了它在管理应用程序(尤 ...

  4. 探索ASP.Net Core 3.0系列四:在ASP.NET Core 3.0的应用中启动时运行异步任务

    前言:在本文中,我将介绍ASP.NET Core 3.0 WebHost的微小更改如何使使用IHostedService在应用程序启动时更轻松地运行异步任务. 翻译 :Andrew Lock   ht ...

  5. 探索 ASP.Net Core 3.0系列三:ASP.Net Core 3.0中的Service provider validation

    前言:在本文中,我将描述ASP.NET Core 3.0中新的“validate on build”功能. 这可以用来检测您的DI service provider是否配置错误. 具体而言,该功能可检 ...

  6. 探索ASP.Net Core 3.0系列六:ASP.NET Core 3.0新特性启动信息中的结构化日志

    前言:在本文中,我将聊聊在ASP.NET Core 3.0中细小的变化——启动时记录消息的方式进行小的更改. 现在,ASP.NET Core不再将消息直接记录到控制台,而是正确使用了logging 基 ...

  7. 探索ASP.Net Core 3.0系列二:聊聊ASP.Net Core 3.0 中的Startup.cs

    原文:探索ASP.Net Core 3.0系列二:聊聊ASP.Net Core 3.0 中的Startup.cs 前言:.NET Core 3.0 SDK包含比以前版本更多的现成模板. 在本文中,我将 ...

  8. ASP.NET Core 2.0 : 三. 项目结构

    本章我们一起来对比着ASP.NET Framework版本看一下ASP.NET Core 2.0的项目结构.(此后的文章也尽量这样对比着, 方便学习理解.) 关注差异, 也为项目迁移做准备. 新建项目 ...

  9. Asp.Net Core Web应用程序—探索

    前言 作为一个Windows系统下的开发者,我对于Core的使用机会几乎为0,但是考虑到微软的战略规划,我觉得,Core还是有先了解起来的必要. 因为,目前微软已经搞出了两个框架了,一个是Net标准( ...

随机推荐

  1. 正确理解java编译时,运行时以及构建时这三个概念

    Java中的许多对象(一般都是具有父子类关系的父类对象)在运行时都会出现两种类型:编译时类型和运行时类型,例如:Person person = new Student();这行代码将会生成一个pers ...

  2. 使用框架帮助Activity规范化

    摘要 本文原创,转载请注明地址:http://kymjs.com/code/2015/05/10/01 写给那些在用.想用.还没有用过KJFrame的朋友. KJFrameForAndroid总共分为 ...

  3. .Net异步编程 z

    1. 引言 最近在学习Abp框架,发现Abp框架的很多Api都提供了同步异步两种写法.异步编程说起来,大家可能都会说异步编程性能好.但好在哪里,引入了什么问题,以及如何使用,想必也未必能答的上来. 自 ...

  4. NLP十大里程碑

    NLP十大里程碑 2.1 里程碑一:1985复杂特征集 复杂特征集(complex feature set)又叫做多重属性(multiple features)描写.语言学里,这种描写方法最早出现在语 ...

  5. Visual Studio Code 构建C/C++开发环境

    转自: https://blog.csdn.net/lidong_12664196/article/details/68928136#visual-sutdio-code%E4%BB%A5%E5%8F ...

  6. Page Redirect Speed Test

    现在,有两种方法可以实现网页的自动跳转. (1) 用html自带的<meta>标签(如下)可以实现网页的自动跳转,而且可以控制跳转的延时. <meta http-equiv=&quo ...

  7. 渐进结构—条件生成对抗网络(PSGAN)

    Full-body High-resolution Anime Generation with Progressive Structure-conditional Generative Adversa ...

  8. IPC$ 测试与防范

    物理机系统:Win7 虚拟机系统:Win2003 Netstat –an 查看本机端口 Netstat –ano 查看本机端口+PID 通过本机上操作(比如登录网站),然后命令,查看对方IP以及端口 ...

  9. EF实体类的枚举属性映射设计方法

    public class FoundationInfo { [Column("id")] public int ID { get; set; } public InvestType ...

  10. (转)Unity3D Android手机开发环境配置,可真机发布调试

    此方法配置好,在可以在unity直接发布到手机上,并可以实时调试. 1.配置eclipse环境:首先在官网下载安装包:http://developer.android.com/sdk/index.ht ...