This project has moved and is read-only. For the latest updates, please go here.

Static file serving from 2 locations

Mar 11, 2014 at 4:53 PM

Is it possible to have static files serving from 2 locations on different ports?
Currently I have one static files location which I specify by using:
    new StaticFileOptions(
        new SharedOptions()
                FileSystem = new PhysicalFileSystem(UILocation)
But I have one more UI app, physically separated from the first one, which I would like to provide using different port.

Is that possible?

Mar 11, 2014 at 5:06 PM
Probably. Are you hosting on HttpListener or IIS?

For HttpListener you can add multiple addresses to one listener, or have two different listeners. If you have two listeners then you can have two Startup's with different configurations. If you have one listener, then you can have one startup, but you'll want to split your pipeline based on the port app.MapWhen(context => context.Request.LocalPort == xxxx, subApp => subApp.UseStaticFiles(...))
Mar 12, 2014 at 11:39 AM

I implemented two Startups with different configurations, and it works.

Thank you for your help.