Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got this small problem, I've got a HG repository server set up and it works fine (at least as far as being a repository & working with HG)

I'm having a problem with the web view because it seems my server wont serve .cs or .csproject files (even though it technically isn't from the context of the hg web view)

My first instinct was to add the MIME type to the server as you can see here:

.cs files added as text/plain

(I've added it at the root webserver level so all sites inherit it)

Anyway, after restarting the IIS Service / App pools / etc... It still is unable to serve .cs files

  • http://myinternalserver/blah.txt Serves fine
  • http://myinternalserver/blah.cs 404's

Am I missing a step here? Is there something funky about a .cs file? It doesn't make sense that it'd be a special type flagged as an "executable" or something because frankly .bat is servable, and it's way more prone to execution that an uncompiled C# file.

Anyone have ideas? Am I just going about this horribly wrong?

share|improve this question
up vote 2 down vote accepted

Look in your web.config and/or applicationhost.config in the <requestFiltering> section. See if you see an entry for .cs and .csproj files with allow set to false:

<add fileExtension=".cs" allowed="false" />
<add fileExtension=".csproj" allowed="false" />

If so, set them to true. They would be under the <fileExtensions> node of the above mentioned <requestFilterings>.

share|improve this answer
Thanks, I couldn't find it in my machine.config, app.config, or applicationhost.config but when I added an allowed="true" i got a 500 error, so I figured it was in the list somwhere. Just added <remove ... /> for both entries in front and it worked \o/, thankyou :) – Aren B Aug 30 '10 at 15:50
This answer is useful when solving this issue as it shows exactly how to structure the web.config file – musefan Jul 21 '15 at 8:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.