visual studio 2015安装.net core 问题

最近装了ubuntu虚拟机,想着实践一下微软跨平台.net core。

1.ubuntu搭建.net环境很简单,参考 https://www.microsoft.com/net/core#ubuntu

试一下永恒的helloword:

ubuntu搭建环境就这么完成了。

2.接着搭建windows平台,想着windows应该更加简单,没想到遇到几个坑折腾很久,这里分享一下。

a.首先更新visual studio update3,此过程就不说了。

b.最新版的.net core是1.0.0-preview2,windows中一开始怎么都安装不了,然后安装了1.0.0-preview1,兴冲冲的发布到ubuntu中时竟然提示找不到该版本,

无奈只能继续安装1.0.0-preview2。

提示我update3没有安装成功,可是确确实实安装成功了,想着可能某些组件没有安装,一气之下重装系统从头开始,结果还是这样。

百度了N久没有好的解决方案,没想到google一下就成功解决。

DotNetCore.1.0.0-VS2015Tools.Preview2.exe SKIP_VSU_CHECK=1

c.创建Asp.net core工程,发布将文件夹的内容通过winscp拷贝到ubuntu系统中,切换到文件目录,执行dotnet 工程名.dll

d.配置nginx 代理

#安装
sudo apt-get install nginx
#配置
sudo nano /etc/nginx/sites-available/default

#添加到后尾
server {
    # Port and domain
    listen 8080;
    server_name aspnet.local;
    
    # Path to the wwwroot folder
    root /home/zulin/dotnet/wwwroot;

    # Pass requests to Kestrel
    location / {
        proxy_pass http://127.0.0.1:5000;
        proxy_set_header Connection "";
        proxy_http_version 1.1;
    }
}
 

#重启服务
sudo service nginx restart
现在可以在浏览器上查看了

http://xxx.xxx.xxx.xxx:8080

原文地址:https://www.cnblogs.com/glly/p/5708834.html