user2480288
user2480288

Reputation: 639

Images not loading and css not referenced after deploying MVC4 application to IIS 8

I have been testing my MVC 4 application using Visual Studio Development Server. Now i have deployed it to IIS 8, the application works but client styling no longer works and the images are also not loaded.

I have been searching all day and not have been able to fix the issue.

Upvotes: 0

Views: 1830

Answers (3)

kroonwijk
kroonwijk

Reputation: 8400

Ha! This is a fun one I had before ;-)

On your system you need to enable delivery of static content for internet information server. Go to control panel, add remove windows features and check STATIC CONTENT under the web services tree.

Et voila, static content (images and css) being delivered to your browser.

Upvotes: 2

Duncan Faulkner
Duncan Faulkner

Reputation: 134

I would recommend using the publish feature in VS, as this will include all files and images. if you can publish directly to the web server the easier it will be, if not publish to a folder (locally) and then copy up to the server.

As Ahmed said check your paths and make sure you code is not pointing to c:\your project\your app\content\images but ../content/images for example.

Upvotes: 0

Ahmed ilyas
Ahmed ilyas

Reputation: 5822

View the source of the page and see if the paths match up to the locations specified. If not - then that is your problem.

How did you deploy it to IIS 8? you show no code on how you are referencing the images/styling in addition to what your deployment directory is.

Upvotes: 1

Related Questions