空MVC5项目中的其他脚本

时间:2014-03-09 09:16:59

标签: asp.net-mvc visual-studio-2013 asp.net-mvc-5

当我创建一个空的MVC5项目并添加一个控制器和视图时,Visual Studio会在HTML源代码的末尾添加一些脚本,如下所示:

script id="__browserLink_initializationData" type="application/json">
{"appName":"Firefox","requestId":"bbb87a70d7564b28910b9fcf0801a4c6"}
</script>
<script async="async" src="http://localhost:63975/5e85be16690c40b598a8d96a30562d1b/browserLink" type="text/javascript">
Reload the page to get source for: http://localhost:63975/5e85be16690c40b598a8d96a30562d1b/browserLink
</script>

有谁能告诉我这是什么以及如何删除它?

1 个答案:

答案 0 :(得分:3)

Browser Link是Visual Studio 2013中的调试帮助程序 - 在请求页面时,HTTP模块会注入HTML。它仅在调试模式下启用(即<compilation debug="true" />) - 并且仅在从Visual Studio运行时启用。

除此之外,它还可以在不同浏览器之间同步导航,并添加需要在Visual Studio和浏览器之间进行通信的其他调试功能。

请点击此处了解有关其功能的更多信息:ASP.NET - Browser Link

您可以(至少)以三种方式禁用它:

  • 在web.config中关闭调试模式(换句话说,它会在发布模式下自动删除):

    <system.web>
      <compilation debug="false" targetFramework="4.5.1" />
      ...
    </system.web>
    
  • 将此添加到web.config即使在debug="true"

    时也将其关闭
    <appSettings>
       <add key="vs:EnableBrowserLink" value="false"/>
       ...
    </appSettings>
    
  • 取消选中“浏览器链接”下拉菜单中的“启用浏览器链接” - 这是(目前至少)一个Visual Studio范围的设置 - 即,在您再次启用它之前,它将保持关闭状态: enter image description here

相关问题