Answered by:
404 returned for .md files in my web app

Question
-
I'm using Azure web apps and I discovered that I cant get md files in a folder or read the folder at all looks like it has to do with file permissions, https://nigerialaws.azurewebsites.net/2017/defence-space-administration-act-2017.md, if I click that, I get a 404, but the file is actually there, if I create a new file with .html extension, it works, for this .md, I get "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."
how do I resolve this please
A-sin Cole
Tuesday, October 9, 2018 6:31 PM
Answers
-
By default, the IIS instance attached to web apps isn't serving the .md file type. To allow that, you'll need to edit your web.config file and add the <mimeMap> line for fileExtension underneath <staticContent>.
<configuration> <system.webServer> <staticContent> <remove fileExtension=".md" /> <mimeMap fileExtension=".md" mimeType="text/markdown" /> </staticContent> </system.webServer> </configuration>
If your web.config is empty the above could be the entire file. Let me know if this works for you.- Proposed as answer by Cody Farmer - MSFTMicrosoft employee Tuesday, October 9, 2018 7:45 PM
- Marked as answer by A-sin Cole Tuesday, October 9, 2018 8:18 PM
Tuesday, October 9, 2018 7:39 PM
All replies
-
By default, the IIS instance attached to web apps isn't serving the .md file type. To allow that, you'll need to edit your web.config file and add the <mimeMap> line for fileExtension underneath <staticContent>.
<configuration> <system.webServer> <staticContent> <remove fileExtension=".md" /> <mimeMap fileExtension=".md" mimeType="text/markdown" /> </staticContent> </system.webServer> </configuration>
If your web.config is empty the above could be the entire file. Let me know if this works for you.- Proposed as answer by Cody Farmer - MSFTMicrosoft employee Tuesday, October 9, 2018 7:45 PM
- Marked as answer by A-sin Cole Tuesday, October 9, 2018 8:18 PM
Tuesday, October 9, 2018 7:39 PM -
Thanks a lot, it worked, if I wanted to serve a folder, is there a similar thing I can do?
A-sin Cole
Tuesday, October 9, 2018 8:18 PM -
Does App Service virtual application and directories help? Refer this blog section Set up the Virtual Directory or Application: https://blogs.msdn.microsoft.com/tomholl/2014/09/21/deploying-multiple-virtual-directories-to-a-single-azure-website/ for more details.
Thursday, October 11, 2018 9:06 PM -
What do you mean by serving a folder? Like allowing a directory view?Friday, October 12, 2018 5:55 PM