Visual Studio 2015 - Debug with HTTP connection problems

心不动则不痛 提交于 2020-05-16 07:43:38

问题


I have a program (console application) that makes use of LinqToTwitter to read some tweets. When I debug the program I get an error "The underlying connection was closed: An unexpected error occurred in a submission".

Message = An error occurred while sending the request. Message = The underlying connection was closed: An unexpected send error occurred.

If I build the program, I can run the program without any problems. I already researched and can't find the problem. Does it have to do with TLS 1.2? How do I set up in Visual Studio? I use VS 2015.


回答1:


Now that you mention TLS 1.2 and you're using an older version of Visual Studio, it makes sense. Add this to your Main procedure:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

Twitter switched to TLS 1.2 a while ago.



来源:https://stackoverflow.com/questions/60959588/visual-studio-2015-debug-with-http-connection-problems

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!