1

I have a web console that I'm building with ServiceStack's AppHostHttpListenerBase (i.e. self hosted).

I'd like to use less.js so I can use .less style sheets but ServiceStack always returns 'Forbidden' when an request is made to any file that isn't .js, .css, .html etc.

I tried using an httpmodule in the app.config to process path "*.less" instead but I'm not sure that ServiceStack self hosted interprets the config file fully.

Is there a way to configure ServiceStack to serve static content of arbitrary filetype?

Robin
  • 698
  • 6
  • 25
  • I cannot understand anything from your question. If you mean html pages, this question and answer is helpful [Is it possible to serve HTML pages with ServiceStack?](http://stackoverflow.com/questions/8199493/is-it-possible-to-serve-html-pages-with-servicestack) – stefan2410 Oct 03 '13 at 12:11
  • 1
    Apologies if wasn't clear. The question compiles to: "how do I serve .less files from self-hosted ServiceStack?" – Robin Oct 03 '13 at 12:28
  • change your question title like you wrote, so your question will be useful to others. Glad you solve it. – stefan2410 Oct 03 '13 at 12:41

1 Answers1

4

Solved this myself. Tip for life: explore with IntelliSense before confusing SO community!

public override void Configure(Funq.Container container)
{
    ServiceStack.Logging.LogManager.LogFactory = new ServiceStack.Logging.Support.Logging.ConsoleLogFactory();

    Plugins.Add(new ServiceStack.Razor.RazorFormat());

    var config = new EndpointHostConfig
    {
        CustomHttpHandlers = {
            { System.Net.HttpStatusCode.NotFound, new ServiceStack.Razor.RazorHandler("/notfound") }
        },
        EnableFeatures = Feature.All ^ Feature.Metadata
    };
    config.AllowFileExtensions.Add("less");
    SetConfig(config);
}
Robin
  • 698
  • 6
  • 25