Skip to content

UsePathBase for aspnetcore 1.0 and UsePathEnvironment()

License

Notifications You must be signed in to change notification settings

eByte23/UsePathBase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UsePathBase

UsePathBase for aspnetcore 1.0 and UsePathEnvironment()

Thanks to Microsoft and community for original code.

This allows you to define sites pathbase in an environment variable and make it optional.

Linux
env ASPNETCORE_APPL_PATH=/app1

Windows
SET ASPNETCORE_APPL_PATH=/app1

Install-Package ebyte23.UsePathBase

You must put this at the top of your apps configure like so.

 public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();
            //This should be your first middleware
            app.UsePathBaseEnvironment(true);
            
            app.UseStaticFiles();
            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }

About

UsePathBase for aspnetcore 1.0 and UsePathEnvironment()

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages