简体   繁体   English

"如何停止 Visual Studio 2022 向 dc.services.visualstudio.com 发送请求"

[英]How to stop Visual Studio 2022 sending requests to dc.services.visualstudio.com

I installed vs 2022 today and when running my project I suddenly se all these requests firing in my web front-end我今天安装了 vs 2022,在运行我的项目时,我突然发现所有这些请求都在我的 Web 前端触发

https://dc.services.visualstudio.com/v2/track

You can follow my steps to disable Application Insights when you debug.您可以按照我的步骤在调试时禁用 Application Insights。

First you can add首先你可以添加

#if !DEBUG
services.AddApplicationInsightsTelemetry();
#endif

in ConfigureServices .ConfigureServices

And second you need add其次你需要添加

#if DEBUG
TelemetryConfiguration.Active.DisableTelemetry = true;
TelemetryDebugWriter.IsTracingDisabled = true;
#endif

in Configure .Configure

在此处输入图片说明

I have a .net 6.0 project for which i want to disable telemetry completely.我有一个 .net 6.0 项目,我想完全禁用遥测。 i have tried the following, but it has no effect.我尝试了以下方法,但没有效果。 any pointers?任何指针?

services.AddApplicationInsightsTelemetry(ai => new TelemetryConfiguration
        {
            DisableTelemetry = true,
        });

Thanks for reporting this.感谢您报告此事。 We've investigated it and identified the source of that request.我们已经对其进行了调查并确定了该请求的来源。 The request has been removed and the fix will be included in an upcoming release.该请求已被删除,修复程序将包含在即将发布的版本中。 You can keep track of when it is released by following this feedback ticket , to which other similar tickets were duped.您可以通过关注此反馈票来跟踪它的发布时间,其他类似票被欺骗了。

I found several solutions (the 1st option helped me):我找到了几个解决方案(第一个选项帮助了我):

1. Disable browser connection 1.禁用浏览器连接

Tools > Options > Project & Solutions > ASP.NET Core工具 > 选项 > 项目和解决方案 > ASP.NET Core

CSS Hot Reload - Disabled CSS 热重载 - 已禁用

May you need to restart VS after changing that option.更改该选项后,您可能需要重新启动 VS。


Go to the browser link toolbar and click the arrow pointing down - shown below.转到浏览器链接工具栏,然后单击向下箭头 - 如下所示。 Turn off "Enable browser link" so that it no longer has a check mark Restart Visual Studio after you have done this.关闭“启用浏览器链接”,使其不再有复选标记,完成此操作后重新启动 Visual Studio。

enter image description here在此处输入图像描述

2. Disable Insights 2.禁用洞察力

Tools > Options > Project & Solutions > Web Projects工具 > 选项 > 项目和解决方案 > Web 项目

turn on " Disable local Application Insights for ASP.NET Core web projects "打开“为 ASP.NET Core Web 项目禁用本地 Application Insights


In file Startup.cs:在文件 Startup.cs 中:

public void ConfigureServices(IServiceCollection services){
...
#if !DEBUG
services.AddApplicationInsightsTelemetry();
#endif
...
}

and:和:

public void Configure(IApplicationBuilder app, IWebHostEnvironment env){
...
#if DEBUG
TelemetryConfiguration.Active.DisableTelemetry = true;
TelemetryDebugWriter.IsTracingDisabled = true;
#endif
...
}

3. Edit file hosts 3.编辑文件主机

Add in file hosts:添加文件主机:

  • 127.0.0.1 dc.services.visualstudio.com 127.0.0.1 dc.services.visualstudio.com
  • 127.0.0.1 rt.services.visualstudio.com 127.0.0.1 rt.services.visualstudio.com

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM