不能得到的Visual Studio 2013浏览器链接与静态的HTML工作 [英] Can't get Visual Studio 2013 browser link working with static html

查看:160
本文介绍了不能得到的Visual Studio 2013浏览器链接与静态的HTML工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直有麻烦Visual Studio的浏览器链接功能工作始终。我已经试过项目它都使用服务栈和角度。

我添加了system.webservice部分的处理,但仍然一无所获。

 <&处理GT;
    <* HTML加名=浏览器链接为HTML路径=动词=*TYPE =System.Web.StaticFileHandler,System.Web程序,版本= 4.0.0.0,文化=中性公钥= b03f5f7f11d50a3a = resourceType为文件preCondition =integratedMode/>
< /处理器>


解决方案

我找到了答案!事实证明,一些与在web.config中的标签是一个有点不同。

我首先必须设置服务栈位置/ API之下。加入这意味着我添加它的API位置下的浏览器链接处理器的时候我没有注意到这一点的时候了。

我又试图将它添加到它自己的system.webServer节,而是给了我服务栈的问题。我发现,即使是空system.webServer部分似乎消灭服务栈HTTP处理程序。 (见第2节system.webServer)

不正确
      
        
          
            
          
        

 <! - 所需的IIS 7.0  - >
    < system.webServer>
      <模块runAllManagedModulesForAllRequests =真/>
      <验证validateIntegratedModeConfiguration =FALSE/>
      <&处理GT;
        <添加路径=*NAME =ServiceStack.FactoryTYPE =ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory,ServiceStack动词=*preCondition =integratedMode= resourceType为未指定allowPathInfo =真/>
      < /处理器>
    < /system.webServer>
  < /地点>
  < system.webServer>
  < /system.webServer>

什么做的工作是移动服务栈HTTP处理程序出了位置标记,并指定路径它单独

正确

 <位置路径=API>
    <&的System.Web GT;
      <&HttpHandlers的GT;
        <添加路径=*TYPE =ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory,ServiceStack动词=*/>
      < / HttpHandlers的>
    < /system.web>
  < /地点>
  <! - 所需的IIS 7.0 - >
  < system.webServer>
    <模块runAllManagedModulesForAllRequests =真/>
    <验证validateIntegratedModeConfiguration =FALSE/>
    <&处理GT;
      <添加路径=APINAME =ServiceStack.FactoryTYPE =ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory,ServiceStack动词=*preCondition =integratedMode= resourceType为未指定allowPathInfo =真/>
      <* HTML加名=浏览器链接为HTML路径=动词=*TYPE =System.Web.StaticFileHandler,System.Web程序,版本= 4.0.0.0,文化=中性公钥= b03f5f7f11d50a3a = resourceType为文件preCondition =integratedMode/>
    < /处理器>
  < /system.webServer>

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>

解决方案

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>

这篇关于不能得到的Visual Studio 2013浏览器链接与静态的HTML工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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