Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fixing the missing virtual path property in Visual Studio 2015

I've been using VS2012 for some years successfully for my asp.net based website but now want to upgrade to VS2015. However, the lack of the virtual path property for the development web server, shown here in VS2012, is preventing me from doing so.

enter image description here

In VS2012 I have it set to / so that static files referenced relative to the root, stylesheets, JS libraries etc. e.g.

    <link rel="stylesheet" href="/assets/template/css/template.css"></link>

can be loaded by the browser.

Without the setting in VS2015 the app compiles and runs perfectly and hyperlinks beginning / work just fine but when the browser attempts to load files referenced like that it receives error 500's (according to Fiddler) so of course none of the client side CSS, JS and some images are loaded.

Is there a solution? I've read answers to similar questions that involve editing config files in the IISExpress folder but I've not been able to find one that relates to this issue specifically.

Presumably I could work round it by adding the host name to the paths programmatically so they end up like:

<link rel="stylesheet" href="http://localhost:57209/assets/template/css/template.css"></link>

but surely there's a better solution?

Thanks for your help.

like image 321
Huw Millington Avatar asked Dec 10 '25 17:12

Huw Millington


1 Answers

A late reaction, probably too late, but may be useful for others. I experienced the same: after opening a VS2013 project in VS2015 the stylesheets were not read. I was amazed that after removing a mimeMap from web.config all worked well. I removed:

<staticContent>
  <mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>

Found this after switching to a 64 bits version of IIS express (in Options/Projects and Solutions/Web Project). Then I got the message that the mimemap had to be removed. No idea when this mimemap has entered the web.config file.

like image 107
HaWa Avatar answered Dec 12 '25 13:12

HaWa



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!