3

I created a certain number of static JSON files with no extension in a subfolder of my site. I want to use them for tests.

The problem is that IIS is refusing to serve them because :

HTTP Error 404.17 - Not Found

The requested content appears to be script and will not be served by the static file handler.

The folder is a subfolder of an ASP.NET application and I can't create an application just for it, neither can I change the parent application's application pool. Actually, I don't have access to the IIS configuration other than through the web.config file in the folder in question.

I assume there must be a way to get a web server to serve static files, right?

2
  • Any progress on this? Facing a similar problem serving extensionless image files on a shared host.
    – Joel Purra
    Oct 22, 2012 at 23:02
  • there is a hotfix support.microsoft.com/kb/2646735 , but it didn't help me :(
    – thorn
    Apr 17, 2013 at 16:32

2 Answers 2

1

Simply add an extension and set the mimetype. If you need extensionless urls then use a URL rewriter to hide the extensions

0

There are all sorts of ways to handle this (by directory, by editing the handler map - just off the top of my head), not the least of which is to simply add an extension. Review this technet document on Configuring handler mapping, and determine which option best fits your needs. See this article on IIS.net about on entries to web.config

2
  • If adding an extension was an option, it would be easy, indeed, but it's not. Handlers don't appear to be the right approach either since I'm serving static files and they're being handled by the static file handler, so I don't know what could be done there.
    – madd0
    Mar 26, 2012 at 19:53
  • adding an extension isn't an option? If you don't want the files to be run as javascript and would prefer them to be processed as static files then you should remove the script code and ensure that there is only HTML code (thus not making them JSON files). Otherwise, I'm not sure it's possible to server javascript without configuring a webserver (any webserver forget IIS) the type of file you are trying to get the browser to see. Have yuo set any type of mime type?
    – Jim B
    Mar 26, 2012 at 21:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .