Note that there are some explanatory texts on larger screens.

plurals
  1. POServiceStack: Serving Static files from a directory when present?
    text
    copied!<p>I am in the process of converting my stand-alone home grown web server to use ServiceStack for serving all pages and resources.</p> <p>I see from this question</p> <p><a href="https://stackoverflow.com/questions/12120276/serving-a-static-file-with-servicestack">Serving a static file with servicestack</a></p> <p>that it is easy to serve a single static file with Service Stack.</p> <p>In my home grown implementation, after checking to see if a URL matches any particular handler (equivalent to ServiceStack routes), the default handler then checks for a static file in its HttpData directory to serve matching the URL. </p> <p>If that file does not exist, it then generates a 404 error.</p> <p>What is the best pattern to use with ServiceStack to serve files from the file system if no other service is matched? Note that I am using it in standalone mode without IIS.</p> <p>These files can be HTML, PNG, JS, and a small handful of other content types.</p> <p>Note: I see the ServiceStack.Razor package <em>may</em> assist my requiredments, but I cannot find the documentation on it. I will put in a separate question about that.</p> <p><em>Edit</em>: I found a reference in this question</p> <p><a href="https://stackoverflow.com/questions/13480673/create-route-for-root-path-with-servicestack">Create route for root path, &#39;/&#39;, with ServiceStack</a></p> <p>indicating</p> <blockquote> <p>Register a <code>IAppHost.CatchAllHandlers</code> - This gets called for un-matched requests.</p> </blockquote> <p>So far, I have not found any documentation or example on <em>how</em> to to this registration. Note: I am running stand-alone, so it needs to be done in C#, not with XML.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload