Beispiel #1
0
        public void Configure(IApplicationBuilder aspNetCoreApp, OwinAppStartup owinAppStartup, IEnumerable <IAspNetCoreMiddlewareConfiguration> aspNetCoreMiddlewares)
        {
#if DotNet
            if (string.IsNullOrEmpty(HostingEnvironment.WebRootPath))
            {
                HostingEnvironment.WebRootPath = _pathProvider.GetStaticFilesFolderPath();
            }

            if (Directory.Exists(HostingEnvironment.WebRootPath) && (HostingEnvironment.WebRootFileProvider == null || HostingEnvironment.WebRootFileProvider is NullFileProvider))
            {
                HostingEnvironment.WebRootFileProvider = new PhysicalFileProvider(HostingEnvironment.WebRootPath);
            }
#else
            if (string.IsNullOrEmpty(WebHostEnvironment.WebRootPath))
            {
                WebHostEnvironment.WebRootPath = _pathProvider.GetStaticFilesFolderPath();
            }

            if (Directory.Exists(WebHostEnvironment.WebRootPath) && (WebHostEnvironment.WebRootFileProvider == null || WebHostEnvironment.WebRootFileProvider is NullFileProvider))
            {
                WebHostEnvironment.WebRootFileProvider = new PhysicalFileProvider(WebHostEnvironment.WebRootPath);
            }
#endif

            ConfigureBitAspNetCoreApp(aspNetCoreApp, owinAppStartup, aspNetCoreMiddlewares);
        }
Beispiel #2
0
        public void Configure(IApplicationBuilder aspNetCoreApp, OwinAppStartup owinAppStartup, IEnumerable <IAspNetCoreMiddlewareConfiguration> aspNetCoreMiddlewares, IServiceProvider serviceProvider, IPathProvider pathProvider)
        {
            IWebHostEnvironment webHostEnvironment = serviceProvider.GetService <IWebHostEnvironment>();

            if (webHostEnvironment != null)
            {
                if (string.IsNullOrEmpty(webHostEnvironment.WebRootPath))
                {
                    webHostEnvironment.WebRootPath = pathProvider.GetStaticFilesFolderPath();
                }

                if (Directory.Exists(webHostEnvironment.WebRootPath) && (webHostEnvironment.WebRootFileProvider == null || webHostEnvironment.WebRootFileProvider is NullFileProvider))
                {
                    webHostEnvironment.WebRootFileProvider = new PhysicalFileProvider(webHostEnvironment.WebRootPath);
                }
            }

            ConfigureBitAspNetCoreApp(aspNetCoreApp, owinAppStartup, aspNetCoreMiddlewares);
        }