Beispiel #1
0
        /// <summary>
        /// 启用全局静态化HostingEnvironment
        /// </summary>
        /// <param name="app"></param>
        /// <returns></returns>
        public static IApplicationBuilder UseGlobalHostingEnvironment(this IApplicationBuilder app)
        {
            var httpContextAccessor = app.ApplicationServices.GetRequiredService <IHostingEnvironment>();

            GlobalHostEnvironment.Configure(httpContextAccessor);
            return(app);
        }
Beispiel #2
0
 /// <summary>
 /// 启用全局静态化HostingEnvironment
 /// </summary>
 /// <param name="app"></param>
 /// <returns></returns>
 public static IApplicationBuilder UseGlobalHostingEnvironment(this IApplicationBuilder app, IHostingEnvironment env)
 {
     GlobalHostEnvironment.Configure(env);
     return(app);
 }