views:

146

answers:

6

Greetings

i have a little problem with my ASP MVC application. On my local development server everything works just fine but when i try to publish the application to an IIS 7.0 server it just displays plain pages without any styles / markups / images.

I put all those things in the /Content/ subfolder but when i try to access that folder on the production server it just returns me a 404 not found error.

I set the IIS server up with .Net 4.0 and followed the deployment guide on here: http://www.asp.net/learn/mvc/tutorial-08-cs.aspx

All views / controllers / classes seem to work just fine, the only thing which does not is the content subfolder and i cant see why.

Anyone got a suggestion what i could have overlooked or does anyone know that problem?

A: 

Check the properties of your content folders...see if they are not 'copying locally' for some reason.

Webjedi
Just checked that... everything gets copied over just fine... seems like somehow the routing gets messed up for existing files. Im using the default routing which should actually take care of that, or am i mistaken?
xenolf
A: 

I have the same problem. Did you ever figure out how to address this issue?

Trey Carroll
A: 

Same issue for me also. Works good in dev server, but as soon as i switch to IIS on my local box (iis 7), i lose images and styles. I tried using Url.Content and that kind of works, but I still lose images that are referenced from the css styles.

SunilK
A: 

This is because you are probably using a fixed path on the src, like: ../../Content/Styles/style.css. In MVC you should use the Url helper: Url.Content("~/Content/Styles/style.css").

Using the Url helper you should have no issues.

Rodrigo Waltenberg
A: 

I had the same issue, but I found the reason why it was forcing authentication on the Contents folder.

When a user is not logged in yet, they are classified as Anonymous Authentication. In IIS7 (which is what I am using, guessing it is the same in IIS6) you need to open the authentication window in features view. Then edit the Anonymous Authentication, to use your application pool identity, or the default one, just make sure that user has permissions to read in that folder.

That fixed it for me, hope it works for you.

Connor Ross