using System; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Newtonsoft.Json; using Vit.WebHost.Extensions.HttpsRedirection; using Vit.WebHost.Extensions.UseCertificates; namespace Vit.WebHost { [JsonObject(MemberSerialization.OptIn)] public partial class HostRunArg { public Func OnCreateWebHostBuilder = () => new WebHostBuilder().UseKestrel(); /// /// /// [JsonProperty] public string[] urls; /// /// /// [JsonProperty] public CertificateInfo[] certificates { get; set; } /// /// /// [JsonProperty] public HttpsRedirectionConfig httpsRedirection { get; set; } /// /// 是否允许跨域访问,默认true /// [JsonProperty] public bool allowAnyOrigin = true; /// /// 映射静态文件,可不指定 /// [JsonProperty] public StaticFilesConfig staticFiles; /// /// 是否异步运行.Runs a web application and returns a Task that only completes when the token is triggered or shutdown is triggered. /// public bool RunAsync = false; public Action OnConfigureServices = null; public Action BeforeConfigure = null; public Action OnConfigure = null; public HostRunArg SetPort(int port = 8888) { urls = new string[] { "http://*:" + port }; return this; } } }