I have searched for solution, and what I found out so far:
Hosting static content directly using
nginxoriis. They are built to serve static files efficiently.For
NancyFxthere is aStaticContentConventionBuilderFor
OWINapp there is aStaticFileMiddlewareCustom static handler: stream file from file system per each request (with old
etag) and manually handleetags,last-modifiedandcache-controlheaders.
Because of my constraints I can't (or don't want to) use 1-3 options.
I think option 4 is not good one (please, correct me, if I'm wrong) because it's expensive to operate with file system. So I want to reinvent the wheel and create efficient static content handler (with caching files content in memory, file system watching etc) or find other solutions.
I looked over docs and source code of managing static content in NancyFx and StaticFiles in OWIN. Both actually are similar to option 4. Why are these methods considered to be efficient?
How to efficiently (customly) serve static files in .NET?