如何在 ASP.NET Core (.NET 6, VS 2022) 中禁用浏览器链接 [英] How to disable Browser Link in ASP.NET Core (.NET 6, VS 2022)

查看:364
本文介绍了如何在 ASP.NET Core (.NET 6, VS 2022) 中禁用浏览器链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Visual Studio 2022 中禁用了浏览器链接,并且还禁用了所有热重载功能.

甚至浏览器链接仪表板也表明它应该被禁用:

我也不使用任何app.UseBrowserLink();代码在我的代码中的任何地方.(如

I have disabled Browser Link inside Visual Studio 2022, and I have also disabled all the Hot Reload functionality.

Even the Browser Link Dashboard indicates it should be disabled:

I also do not use any of the app.UseBrowserLink(); code anywhere in my code. (as documented in Browser Link in ASP.NET Core.

However, these middlewares still somehow appear in the request pipeline:

  • Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserRefreshMiddleware
  • Microsoft.WebTools.BrowserLink.Net.BrowserLinkMiddleware

These middlewares add this to my HTML:

<!-- Visual Studio Browser Link -->
<script type="text/javascript" src="https://localhost:44399/0928d478a97d441187231f2a1a7cd5e5/browserLink" async="async" id="__browserLink_initializationData" data-requestId="c94cf93088fb44e98f4e499b20ad7bfe" data-requestMappingFromServer="False"></script>
<!-- End Browser Link -->

<script src="/_framework/aspnetcore-browser-refresh.js"></script></body>

And every time I save a file, it reloads the browser. I want to stop this behaviour, and I ran out of options how.

Is this something that the IIS Express or Visual Studio add automatically?

I also checked all the packages and DLLs, and I don't see it included anywhere in my code. It must be included automatically via some "magic" that Visual Studio 2022 does.

How do I stop all this reloading? I do not want any Browser Link or Browser Refresh. Please help, I spent a lot of time on this, and I'm desperate.

解决方案

You are almost there. You just need to also config the following (Don't forget to restart your VS):

这篇关于如何在 ASP.NET Core (.NET 6, VS 2022) 中禁用浏览器链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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