using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; using CoreEntity.TimedTask; using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Quartz.Spi; //using SupplierWeb.TimedTask; using ZcPeng.PublicLibrary; namespace SupplierWeb { public class Program { //注册各种服务 static void RegisterServices(IServiceCollection services) { //日志相关 //services.AddSingleton(); //services.AddSingleton(typeof(ILogger<>), typeof(Logger<>)); //services.AddLogging(builder => builder.SetMinimumLevel(LogLevel.Trace)); //定时任务相关 //services.AddSingleton(); //services.AddSingleton(); } public static void Main(string[] args) { // 在应用程序启动时运行的代码 //填写默认的SQL SERVER数据库连接字符串 //DataAccess.connectionString = "Data Source=YourDataSource;Initial Catalog=YourDb;Persist Security Info=True;User ID=YourUserId;Password=YourPassword"; //DataAccess.connectionString // = "Data Source =localhost\\MSSQLSERVER12; Initial Catalog = ERPSupplierPortal; Persist Security Info = True; User ID = sa; Password = pzc4213;Pooling=true;MAX Pool Size=512;Min Pool Size=50;Connection Lifetime=30"; //DataAccess.connectionString // = "Data Source =192.168.50.30; Initial Catalog = LJHYBZK; Persist Security Info = True; User ID = sa; Password = xq!@#2014;Pooling=true;MAX Pool Size=512;Min Pool Size=50;Connection Lifetime=30"; DataAccess.connectionString = "Data Source =192.168.20.122; Initial Catalog = MemberData; Persist Security Info = True; User ID = ljhyPortal2016; Password =testliangjian@#!)2016;Pooling=true;MAX Pool Size=512;Min Pool Size=50;Connection Lifetime=30"; BuildWebHost(args).Run(); } public static IWebHost BuildWebHost(string[] args) => WebHost.CreateDefaultBuilder(args) .UseContentRoot(Directory.GetCurrentDirectory()) .ConfigureAppConfiguration((hostingContext, config) => { var env = hostingContext.HostingEnvironment; config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true); config.AddEnvironmentVariables(); }) .ConfigureLogging((hostingContext, logging) => { logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging")); logging.AddConsole(); logging.AddDebug(); }) .UseStartup() .UseUrls(new string[] { "http://*:57252" }) .Build(); public static IWebHostBuilder CreateWebHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args) .UseUrls("http://*:5080") .UseKestrel() //.UseUrls(new string[] { "http://*:44383" }) 没有作用 .UseStartup(); } }