Visual Studio 2013 has a cool new feature called Browser Link. You can read about it here and here. It doesn’t seem to work flawlessly yet, according to a colleague of mine but nevertheless it’s a great feature.
If you want to enable browser link for static html files you must do something extra by adding a StaticFileHandler
to your Web.config
and make sure you set runAllManagedModulesForAllRequests
to true
:
<system.webServer> <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> <modules runAllManagedModulesForAllRequests="true" /> </system.webServer>
This is all well documented so it shouldn’t pose a problem. I had everything configured and ready to go but I kept getting a ‘No current connections’ message in the Browser Link Dashboard when hitting http://localhost/
After reading the documentation again, checking my config again and Googling around, I thought: maybe I shouldn’t hit http://localhost/
but instead visit http://localhost/index.html
. Not sure why but it started working! Apparently, the static file handler doesn’t run when not explicitly invoking a *.html
page?
The strange thing is, now that I’ve hit /index.html
once, I can’t reproduce the problem anymore. No matter how I enter the site, Browser Link works. But if you ever encounter this problem, try visiting the page you want directly and do not depend on the default page.