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?
Been pulling my hair out all night with this one.
On W2K8, MVC2, .NET 4.0, and IIS 7 (using VS 2010)
Made sure that IIS_IUSRS had full rights to the root folder but still no go - css, js, images still not being accessed in rendering the page....
and then .... so simple:
In Features view for the site - defined MIME types for .js, .css, and .jpg - and voila!
Sweet!
p.s. my 1st mvc app - and I think I'm liking it...
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.
Well, I added the
IIS_IUSR
s to the project directory and found the same problem:CSS won't load and nothing from the content folder.
But it resolved the
Unable to start debugging on the web server
problem.Then, I added the
IUSR
to the same folder and that fixed the problem. Now, I can see images, css styles and all that stuff.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.
Check the properties of your content folders...see if they are not 'copying locally' for some reason.
The folder that your virtual directory is pointing to gave to the user "All" reading properties.