Centos7+ASP.Net Core 運行


一:ASP.Net Core跨平台運行,需要在Linux安裝運行環境。本機器使用的Centos,下載安裝地址為:https://www.microsoft.com/net/core#centos

sudo yum install libunwind libicu
curl
-sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?LinkID=827529 sudo mkdir -p /opt/dotnet && sudo tar zxf dotnet.tar.gz -C /opt/dotnet sudo ln -s /opt/dotnet/dotnet /usr/local/bin

安裝完成后運行dotnet,出現如下圖則說明環境安裝成功!

發布項目見:http://www.cnblogs.com/gaobing/p/5663012.html#3468403

修改project.json文件內容

    "Microsoft.NETCore.App": {
      "version": "1.0.1",
      //"type": "platform"
    },
  //"scripts": {
  //  "prepublish": [ "bower install", "dotnet bundle" ],
  //  "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  //}
 
添加:
 "runtimes": {
    "centos.7-x64": {} 

  }

發布項目:

cd /d 項目根目錄

還原項目

dotnet restore

發布

dotnet publish -r centos.7-x64

把項目添加到Centos中

修改Jexus中的siteconf/default文件

  AppHost={CmdLine=應用程序命令行; workRoot=應用程序工作目錄; Port=應用程序HTTP偵聽端口},其中:
 "CmdLine" 表示啟動應用程序的命令行,如:dotnet /var/www/site1/app.dll;
 "workRoot"表示應用程序工作目錄,如:/var/www/site1;
 "Port"表示這個HTTP應用程序所使用的偵聽端口,如:5000(Asp.Core默認端口是5000)

配置執行權限

cd /var/www/default
sudo chmod a+x wds
ls

試運行自宿主工作情況

cd /var/www/default
dotnet wds.dll

啟動jexus

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM