views:

22

answers:

2

I've been developing an MVC 2 application under the built in Web-server in VS2010. On Friday, I moved it to a virtual directory under IIS 5 in my WinXP development machine. I had the usual problems, and added a wildcard mapping to the Virtual Directory configuration in IIS to map .* to aspnet_isapi.dll (Framework 4). Neither the check file exists box nor the Script Engine box is checked.

The routing works and brings up the correct page. But none of the css or js files are served. Fiddler shows them getting either 401 (Not Authorized) or 404 (Not Found) errors (with no apparent rhyme or reason to which one - sometimes both). I went back in and added IgnoreRoute statements to the mapping tables for .css and .js, files, but that made no difference. I also added LOCALMACHINE\ASPNET to the security settings on the directory, giving it (for right now) full control permissions (I know that's a security hole, but I'll fix it after I get it running.)

I have not seen this problem referred to in any of the blog posts on getting MVC running on pre-IIS 7 servers. Has anyone else seen it, and how did you solve it?

A: 

The simplest and most straightforward way I've found to get the scripts/graphics/css files working is to specifically remove the wildcard mapping to aspnet_isapi for your content directories (graphics, scripts, css), in the same way that you added them for the project directory.

Right click on your scripts folder and select properties, and hit Create. The configuration button will now be available; click it and hit Remove to remove the custom mapping that the folder inherited from it's parent; click okay. Now back in the properties dialog for the folder, click Remove, so it's no longer a virtual directory, and click OK. Repeat for other such folders.

Patrick Karcher
A: 
lakhlaniprashant.blogspot.com