Asp.Net Core發布綁定域名和端口


一.WebHostBuilder配置URL和端口進行偵聽 UseUrls()

1.默認的ASP.NET Core項目綁定http://localhost:5000。通過使用UseUrls擴展方法——編輯urls命令行參數

2.指定格式:http://xxx:xxx,如:http://*:81

var host = new WebHostBuilder()
    // .UseUrls("http://localhost:5003","http://www.sqlme.com:80")
    //.UseUrls("http://*:8000")
    .UseUrls("http://www.sqlme.com:8000")
    .UseKestrel()
    .UseContentRoot(Directory.GetCurrentDirectory())
    .UseIISIntegration()
    .UseStartup<Startup>()
    .UseApplicationInsights()
    .Build();

3.如果當前機器已經安裝了IIS等服務器軟件,那么監聽 80端口就會拋出異常。

4.如果使用不同的域名共享一個 端口,可以參考WebListener

二、關於ASP.NET Core WebListener 服務器

WebListener支持以下功能:

  • Windows Authentication
  • Port sharing
  • HTTPS with SNI
  • HTTP/2 over TLS (Windows 10)
  • Direct file transmission
  • Response caching
  • WebSockets (Windows 8)

支持的Windows版本:

  • Windows 7和Windows Server 2008 R2和更高版本

 

更多 :

.Net Core郵件發送之MailKit

Asp.Net Core WebAPI入門整理(三)跨域處理

Asp.Net Core中Json序列化處理整理


免責聲明!

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



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