首先下载 对应的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

最新文章

  1. CodeForces 515C. Drazil and Factorial
  2. jira 6.3.6安装-汉化-破解
  3. sass揭秘之@mixin,%,@function
  4. hadoop报错:WARN mapred.JobClient: Error reading task outputNo route to host
  5. Bundle savedInstanceState的作用
  6. Matlab里面的SVM
  7. [f]区间随机数函数
  8. Xenomai
  9. Configure the AD FS server for claims-based authentication -zhai zi wangluo
  10. HDU 4606 Occupy Cities (计算几何+最短路+最小路径覆盖)
  11. 代码风格——Cocos2d-x学习历程(四)
  12. JS严格模式和非严格模式的区别
  13. 10gocm-&amp;gt;session5-&amp;gt;数据库管理实验
  14. [转]OPENSOLARIS 2009.06 REPOSITORY ISO IMAGES NOW AVAILABLE
  15. 图解JOIN
  16. php websocket聊天室
  17. JS中offsetTop、clientTop、scrollTop、offsetTop各属性介绍(转载)
  18. JavaScript判断数组是否存在key
  19. js添加删除元素内容
  20. Fix “Could not flush the DNS Resolver Cache: Function failed during execution” When Flushing DNS

热门文章

  1. Selenium2+python自动化41-绕过验证码(add_cookie)
  2. fisher精确检验(fisher’s exat test)和超几何分布
  3. 我所遭遇过的游戏中间件---HumanIK
  4. unity opaque sort
  5. ASP.NET MVC中使用jQuery时的浏览器缓存问题
  6. 【Multiple backgrounds】用CSS3实现网页多重背景
  7. IOS Xib使用——为控制器添加Xib文件
  8. SqlServer数据库(可疑)解决办法4种
  9. Android -- PullToRefresh应用
  10. git简单运用