0

I'm having a very strange issue. In our app, I have Content Pages, in Help folder in the root of the app. Within the help folder I have a bunch of Markdown files with a .md extension. These are served with the a route, for example:

http://localhost/myapp/help/calendar

the result would be that when the user navigates to that path, the calendar.md file would be picked up by SS and sent to the browser.

The problem i'm having is that path returns a SS 404 error.

If I changed calendar.md to calendar.cshtml, it works. My content is picked up by SS and sent to the browser as expected.

Why would it provide me the content with a .cshtml file, but a .md file is giving me a 404?

I'm running SS 3.9.70.

Anyone know what could be the cause? Environmental?

Snippet from AppHost

AllowFileExtensions = { "swf", "webm", "mp4" },
MarkdownBaseType = typeof(BaseHelpPage),  
MarkdownGlobalHelpers = new Dictionary<string, Type> { { "Url",typeof(UrlHelper) } },
CustomHttpHandlers =  {
    { HttpStatusCode.Unauthorized, new RazorHandler("/AccessDenied") },
    { HttpStatusCode.Forbidden, new RazorHandler("/AccessDenied") },
    { HttpStatusCode.NotFound, new RazorHandler("/NotFound") }
},
legion
  • 497
  • 1
  • 5
  • 15

1 Answers1

1

You need to add .md and .markdown file types to ServiceStack's file extensions whitelist. In your Configure method of AppHost you can specify file extensions to allow using AllowFileExtensions:

SetConfig(new EndpointHostConfig {
    AllowFileExtensions = { "md", "markdown" }
});
Scott
  • 21,211
  • 8
  • 65
  • 72
  • Wouldn't that just allow me to "download" the .md .markdown files? I'm trying to use Markdown Razor as described here: https://github.com/ServiceStack/ServiceStack/wiki/Markdown-Razor – legion Apr 23 '15 at 22:56
  • @legion Sorry your use of `trying serve up static markdown` implied direct download of markdown files. If you are trying to serve `dynamic` markdown with razor have you enabled the razor plugin? `Plugins.Add(new RazorFormat());` – Scott Apr 24 '15 at 07:48
  • Yes, I've got that enabled as I'm able to serve `dynamic` razor cshtml views. – legion Apr 24 '15 at 19:46