12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- 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<ILoggerFactory, LoggerFactory>();
- //services.AddSingleton(typeof(ILogger<>), typeof(Logger<>));
- //services.AddLogging(builder => builder.SetMinimumLevel(LogLevel.Trace));
- //定时任务相关
- //services.AddSingleton<IJobFactory, MyServiceJobFactory>();
- //services.AddSingleton<PushJob>();
- }
- 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<Startup>()
- .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<Startup>();
- }
- }
|