标签:ted root name 应用程序 star hosting pre sof tin
IHostingEnvironment对象中是一些该应用程序的环境信息,包括程序名称信息,根目录,环境名称 等等基本信息
await context.Response.WriteAsync($"name=\"{env.ApplicationName}\"");
await context.Response.WriteAsync($"name=\"{env.ContentRootFileProvider}\"");
await context.Response.WriteAsync($"name=\"{env.ContentRootPath}\"");
await context.Response.WriteAsync($"name=\"{env.EnvironmentName}\"");
await context.Response.WriteAsync($"name=\"{env.WebRootFileProvider}\"");
IApplicationLifetime对象是用来绑定应用程序的运行时事件的
applicationLifetime.ApplicationStarted.Register(() =>
{
Console.WriteLine("Strated");
});
applicationLifetime.ApplicationStopping.Register(() =>
{
Console.WriteLine("Stoping");
});
applicationLifetime.ApplicationStopped.Register(() =>
{
Console.WriteLine("Strated");
}
未完待续...
Asp.net Core-IHostingEnvironment和IApplicationLifetime的使用
标签:ted root name 应用程序 star hosting pre sof tin
原文地址:https://www.cnblogs.com/fanfan-90/p/12144537.html