首页 > 解决方案 > 在 Manage Extensions,VS 2019 中强制关闭现有连接

问题描述

刚刚在一台新的笔记本电脑上安装了 vs2019 社区。

打算安装一些扩展程序,我看到了

在此处输入图像描述

如果我刷新几次,我可能会看到扩展,但在下一次刷新或转到扩展的下一页时,我会看到相同的内容。

不知道发生了什么,为什么以及如何解决它。

更新

我尝试从市场站点安装扩展程序。它失败了

在此处输入图像描述

我再次打开日志,同样的错误:

14/05/2021 17:52:17 - One or more errors occurred.
14/05/2021 17:52:17 -    at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at Microsoft.VisualStudio.ExtensionManager.VSGalleryRepository.GetExtensions[T](List`1 extensionIds, Int32 lcid, Boolean forAutoupdate)
   at VSIXInstaller.ExtensionPackService.GetExtensionByVsixId(List`1 vsixIds, String extensionPackParentName, IExtensionEngine extensionEngine, List`1 extensionsToInstall, CancellationToken cancellationToken)
14/05/2021 17:52:17 - END: Gathering extension pack information
14/05/2021 17:52:17 - END: Processing extension pack
14/05/2021 17:52:17 - System.AggregateException: One or more errors occurred. ---> System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
   at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult)
   at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult)
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
   --- End of inner exception stack trace ---
   at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)
   at System.Net.PooledStream.EndWrite(IAsyncResult asyncResult)
   at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context)
   at System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar)
   --- End of inner exception stack trace ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ExtensionManager.VSGalleryRepositoryHelper.<PostAndGetResponseAsync>d__9`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ExtensionManager.VSGalleryRepository.<>c__DisplayClass14_0`1.<<GetExtensionsOrCategoriesAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ExtensionManager.VSGalleryRepository.<GetExtensionsOrCategoriesAsync>d__14`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ExtensionManager.VSGalleryRepository.<GetExtensionsAsync>d__13`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ExtensionManager.VSGalleryRepository.<>c__DisplayClass12_0`1.<<GetExtensions>b__1>d.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at Microsoft.VisualStudio.ExtensionManager.VSGalleryRepository.GetExtensions[T](List`1 extensionIds, Int32 lcid, Boolean forAutoupdate)
   at VSIXInstaller.ExtensionPackService.GetExtensionByVsixId(List`1 vsixIds, String extensionPackParentName, IExtensionEngine extensionEngine, List`1 extensionsToInstall, CancellationToken cancellationToken)
   at VSIXInstaller.ExtensionPackService.AcquireExtensionPack(IList`1 extensionsPath, IStateData stateData, Boolean isRepairSupported)
   at VSIXInstaller.ExtensionPackService.ExpandExtensionPackToInstall(IStateData stateData, Boolean isRepairSupported)
   at VSIXInstaller.App.Initialize(Boolean isRepairSupported)
   at VSIXInstaller.App.Initialize()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
---> (Inner Exception #0) System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
   at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult)
   at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult)
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
   --- End of inner exception stack trace ---
   at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)
   at System.Net.PooledStream.EndWrite(IAsyncResult asyncResult)
   at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context)
   at System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar)
   --- End of inner exception stack trace ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ExtensionManager.VSGalleryRepositoryHelper.<PostAndGetResponseAsync>d__9`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ExtensionManager.VSGalleryRepository.<>c__DisplayClass14_0`1.<<GetExtensionsOrCategoriesAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ExtensionManager.VSGalleryRepository.<GetExtensionsOrCategoriesAsync>d__14`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ExtensionManager.VSGalleryRepository.<GetExtensionsAsync>d__13`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ExtensionManager.VSGalleryRepository.<>c__DisplayClass12_0`1.<<GetExtensions>b__1>d.MoveNext()<---

更新 2

似乎即使从浏览器连接到市场也是一个问题

在此处输入图像描述

更新 3 使用 Fiddler 进一步检查问题后,我得到 HTTPS 握手失败。

更新 4 通过另一个 WIFI 网络连接到互联网时,问题消失了。更具体地说,我将手机变成了 wifi 热点并通过手机连接。没有更多与视觉工作室市场的连接错误......

更新 5 - 解决方案 在我意识到问题出现在某些 wifi 网络中且并非总是如此后,我怀疑我的 wifi 适配器设置有问题。我从我的适配器设置中删除了 ipv6,一切都像一个魅力。

标签: visual-studiovisual-studio-extensions

解决方案


在阅读了很多关于该问题的不同解决方案之后,其中大部分是关于代理设置的配置,我终于找到了导致问题的原因。

我发现的解决方案都没有奏效。唯一足够接近的是一篇关于从 Visual Studio 的配置文件中禁用 ipv6 的帖子。我这样做了,但似乎忽略了更改。所以我虽然 ipv6 在我的情况下不会成为根本原因并改变了方向,但徒劳无功。

在某个时候,当我需要连接到不同的 Wi-Fi 网络时,我意识到问题已经消失了。只有在某些 wi-fi 中我才有这个问题,而且只有在我的笔记本电脑上。不是我的任何其他设备。所以我怀疑我的笔记本电脑的 Wi-Fi 适配器设置和 Wi-Fi 网络一定是导致问题的某种组合。

摆弄我的 Wi-Fi 网络适配器的设置,我找到了我需要做的事情。我不得不从我的 Wi-Fi 适配器设置中禁用 ipv6

问题消失了。

在此处输入图像描述


推荐阅读