Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't get Visual Studio 2013 browser link working with static html

I've been having trouble getting Visual Studio's browser link functionality to work consistently. The projects I've tried it in have all used Service Stack and Angular.

I've added the handler in the system.webservice section but still nothing.

<handlers>
    <add name="Browser Link for HTML" path="*.html" verb="*" type="System.Web.StaticFileHandler, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" resourceType="File" preCondition="integratedMode" />
</handlers>
like image 568
mark Avatar asked Dec 27 '13 20:12

mark


People also ask

How to disable Browser Link in Visual Studio 2013?

Disabling Browser Link There are several ways to disable it: In the Browser Link dropdown menu, uncheck Enable Browser Link. In the Web. config file, add a key named "vs:EnableBrowserLink" with the value "false" in the appSettings section.


1 Answers

I found the answer! It turns out that something with the tag in the web.config is a bit different.

I had setup service stack first under the location /api. I didn't notice this right away when adding the browser link handler which meant I added it under the api location.

I then tried to add it to it's own system.webServer section but that gave me issues with service stack. I found that even an empty system.webServer section seemed to wipe out the service stack http handler. (see the 2nd system.webServer section)

INCORRECT

    <!-- Required for IIS 7.0 -->
    <system.webServer>
      <modules runAllManagedModulesForAllRequests="true" />
      <validation validateIntegratedModeConfiguration="false" />
      <handlers>
        <add path="*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />            
      </handlers>
    </system.webServer>
  </location>
  <system.webServer>
  </system.webServer>

What did work was to move the service stack http handler out of the location tag and specify the path for it separately

CORRECT

<location path="api">
    <system.web>
      <httpHandlers>
        <add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" />
      </httpHandlers>
    </system.web>
  </location>
  <!-- Required for IIS 7.0 -->
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
      <add path="api" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
      <add name="Browser Link for HTML" path="*.html" verb="*" type="System.Web.StaticFileHandler, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" resourceType="File" preCondition="integratedMode" />
    </handlers>
  </system.webServer>
like image 90
mark Avatar answered Sep 19 '22 12:09

mark