1

I have searched for solution, and what I found out so far:

  1. Hosting static content directly using nginx or iis. They are built to serve static files efficiently.

  2. For NancyFx there is a StaticContentConventionBuilder

  3. For OWIN app there is a StaticFileMiddleware

  4. Custom static handler: stream file from file system per each request (with old etag) and manually handle etags, last-modified and cache-control headers.

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?

kanggary
  • 71
  • 3

0 Answers0