Fix missing virtual path property in Visual Studio 2015

I've been using VS2012 for my asp.net based site for a few years now, but now want to upgrade to VS2015. However, the absence of the virtual path property for the development web server shown here in VS2012 prevents me from doing this.

enter image description here

In VS2012 I have set / so static files are referenced relative to root, stylesheets, JS libraries, etc., for example.

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

      

can be loaded by browser.

Without installing in VS2015, the app compiles and runs fine and the hyperlinks start / work just fine, but when the browser tries to download the linked files it gets a 500 error (according to Fiddler), so of course none of the client-side CSS, JS and some images are uploaded.

Is there a solution? I have read answers to similar questions that have to do with editing configuration files in the IISExpress folder, but I could not find one that pertains to this issue.

Presumably I could work around this by adding the hostname to the path programmatically so that they end up like this:

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

      

but is the best solution correct?

Thank you for your help.

+3


source to share


2 answers


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

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

      



Found this after switching to 64-bit version of IIS express (under Options / Projects and Solutions / Web Project). Then I got a message that the mimemap had to be removed. Not sure when this mimemap introduced the web.config file.

+2


source


You can do this from one of the page properties windows for your site. I did it in 2013, but I don't remember exactly what I did. I think you will open the page properties window (by pressing Shift + f4, in the view menu, or the wrench icon in the properties window) and then go to the launch options.

This post has the property window image you are looking for. Not sure if they changed it for 2015. Is there a way to add a virtual directory to Visual Studio Development Server?



Hope this helps.

-1


source







All Articles