first commit
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
|
||||
using Autofac.Extensions.DependencyInjection;
|
||||
|
||||
namespace JSMachine.WMS.WebHost
|
||||
{
|
||||
/// <summary>
|
||||
/// WebHost 进程启动入口,配置文件和 Autofac 容器由此加载。
|
||||
/// </summary>
|
||||
public static class WebHostEngine1
|
||||
{
|
||||
/// <summary>
|
||||
/// 创建并运行 WebHost;宿主同时注册为 Windows 服务。
|
||||
/// </summary>
|
||||
public static void Start()
|
||||
{
|
||||
Host.CreateDefaultBuilder()
|
||||
.ConfigureWebHostDefaults(webBuilder =>
|
||||
{
|
||||
webBuilder.UseStartup<Startup>();
|
||||
})
|
||||
.ConfigureAppConfiguration((hostingContext, config) =>
|
||||
{
|
||||
config
|
||||
.SetBasePath($"{hostingContext.HostingEnvironment.ContentRootPath}")
|
||||
.AddJsonFile("appSettingsWebhost.json", false, true)
|
||||
.AddEnvironmentVariables();
|
||||
})
|
||||
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
|
||||
.UseWindowsService()
|
||||
.Build()
|
||||
.Run();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user