无法使用静态 html 获取 Visual Studio 2013 浏览器链接 [英] Can't get Visual Studio 2013 browser link working with static html

查看:22
本文介绍了无法使用静态 html 获取 Visual Studio 2013 浏览器链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直无法让 Visual Studio 的浏览器链接功能始终如一地工作.我尝试过的项目都使用了 Service Stack 和 Angular.

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.

我已经在 system.webservice 部分添加了处理程序,但仍然没有.

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>

推荐答案

我找到了答案!事实证明,web.config 中带有标记的内容有点不同.

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

我首先在位置/api 下设置了服务堆栈.添加浏览器链接处理程序时我没有立即注意到这一点,这意味着我将它添加到 api 位置下.

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.

然后我尝试将它添加到它自己的 system.webServer 部分,但这给我带来了服务堆栈的问题.我发现即使是一个空的 system.webServer 部分似乎也清除了服务堆栈 http 处理程序.(参见第二个 system.webServer 部分)

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)

不正确

    <!-- 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>

起作用的是将服务堆栈http处理程序移出位置标记并单独为其指定路径

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

正确

<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>

这篇关于无法使用静态 html 获取 Visual Studio 2013 浏览器链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆