How to fix images paths in CSS after IIS publishing?

I'm new with MVC (V4) and I have an issue after publishing my site to IIS. My site works perfectly when viewed in IIS express though the web browser (and page inspector). However, when I publish my website (through VS2012) to IIS all my Images being references from my CSSs are broken.

My CSS folder is as follows:


My Images folder is:


<strong>The folder structure is identical both on IIS virtual directories and my project directories.</strong>

All my images are referenced like this:


When I change my CSS references to ../Images/MyImages/image.jpg it starts to work again. This does not consists to the actual physical folder paths of the IIS application/Virtual directory.

I will appreciate any help solving this out.


If you are using bundles you should use ~/ eg. @Styles.Render("~/bundles/stylebundle") in your views.

When defining your bundles always start the file paths with ~/. eg

bundles.Add(new StyleBundle("~/bundles/test") .Include("~/content/test/test.css"));

Any paths in your css should be relative to the css file itself.

eg background-image: url('../../Images/test.jpg');

I've just built a test site using the same structure you have and sticking to what I've written above and it all works in both debug and release. To fake the release mode on your local machine inyour bundle config file add

BundleTable.EnableOptimizations = true;


  • Set audio input level using portaudio
  • how do you read the ramda docs?
  • wxWidgets: Detecting click event on custom controls
  • Is it one-to-one or Component ? Nhibernate Mapping
  • Installing PAR::Packer on Windows, dmake error 255
  • How to get the index of element in the List in c#
  • Is it possible to send skype chat messages from a linux server without X?
  • Specifying virtual keyboard type for EditText in XML
  • What's the name of this finding square root algorithm?
  • Local Development, Apache vs Developer - file permissions
  • Less Conflicting Session Manager for Zope 2
  • Flask not finding files in my package's 'static' directory
  • PDO error when wrong host name
  • Getting short path in python
  • Sensibility of combined Maven/Ant+Ivy build management for dual platform Desktop/Android deployment?
  • Yii2: Finding file and getting path in a directory tree
  • Bootstrap (v3.3.4) glyphicons not displayed in IE when refresh page (F5)
  • Pycharm: Marking a folder as 'sources root' is not recursive for subfolders
  • Android Studio 1.3 RC3. Google Play services out of date. Requires 7571000 but found 6774470
  • Elasticsearch script query involving root and nested values
  • What is the purpose of TaskExecutor in spring?
  • JBoss External Properties Files in Classpath
  • Adjust width of select element according to selected option's width
  • htaccess add www if not subdomain, if subdomain remove www
  • Moving mysql files across servers
  • Paperclip, set path outside of rails root folder
  • Jenkins: How To Build multiple projects from a TFS repository?
  • javaw.exe and eclipse startup problems
  • Align navbar back button on right side
  • DotNetZip - Calculate final zip size before calling Save(stream)
  • Modifying destination and filename of gulp-svg-sprite
  • Warning: Can't call setState (or forceUpdate) on an unmounted component
  • Proper folder structure for lots of source files
  • Load html files in TinyMce
  • Free memory of cv::Mat loaded using FileStorage API
  • CSS Applying specific rule for a specific monitor resolution with only CSS is posible?
  • Change div Background jquery
  • Append folder name and increment by 1 using batch script
  • How can i traverse a binary tree from right to left in java?
  • Unable to use reactive element in my shiny app