Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Can one serve "static" but external content underneath an asp.net.core application

$
0
0

We've got an application that we deploy on Linux.  It's a self contained application that is started up from systemctl and uses Kestrel.  This is the "server side" code, but in this picture there is a client side application that needs to be hosted.  My hope was to serve that client side code from the same Kestrel process by being able to reference a directory on the filesystem.  But, that content isn't resident at compile time and would be placed there for serving after the server piece was in place (and may be updated as development occurs.)

So after some unsuccessful experimentation based on forays into the documentation I landed here wondering if A) is this even possible and B) what should I look at to go about doing such.

I have my fall-back of using nginx, but if I could not have to install that on machines that would be great.

In the app, here is the context of how we define our Kestrel (with much stuff related to certs, ports, etc. omitted) with one of my failed attempt at referencing an external location.  Note:  There is no wwwroot or content used by the server app, everything is all API calls via controllers.

WebHost.CreateDefaultBuilder(args) 
    .UseStartup<Startup>()
    .UseKestrel()
    .ConfigureKestrel((context, options) =>
    { //omitted lots of stuff for brevity
    })
    .UseContentRoot("/var/foo/webapi/client") //A sample attempt at adding a location where client code lives.
    .UseNLog()
    .Build();


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>