Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have request filtering enabled and "Allow unlisted file name extensions" is set to false. When requesting any normal path, including "http://localhost" I get a 404.7 error - "The request filtering module is configured to deny the file extension."

If I set "Allow unlisted file name extensions" to true then the site works fine.

I know that "http://localhost/" maps to Views/Homes/Index.cshtml" and .cshtml is explicitly allowed.

I am trying to figure out which file extension is causing the issue but can't find anything in the logs. I have all 55 "default" file types set to allow.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Try just "." as the file extension. This seems to work on a Windows 2008 R2 SP1 box with ASP.NET 4.

I haven't seen this documented anywhere, but it follows the same rule as the Handler Mappings for extensionless URLs that were introduced in ASP.NET 4 / W2K8 R2 SP1 (see Meaning of path attribute on handlers in web.config question).

share|improve this answer

I think what you're trying to do is not possible.

MVC doesn't use file extensions. By setting "Allow unlisted file name extensions" to false, you limit IIS to just serve the extensions listed. As you can't add an 'extensionless extension' IIS denies the request.

In other words, you need "Allow unlisted file name extensions" set to true if you want to use MVC.

You don't have to allow '.cshtml' you can even deny access to it, MVC still works, because the view files are not served directly by IIS by read by MVC and then send via IIS to the client.

share|improve this answer

Your Answer

 
discard

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.