WinHTTP-与服务器的连接异常终止 [英] WinHTTP - The connection with the server was terminated abnormally
问题描述
我导入WinHTTP并尝试在https网址中执行请求,如下所示:
函数TForm1.GetPage(AURL:String):字符串;变种WinHttpRequest:IWinHTTPRequest;开始CoInitialize(nil);尝试WinHttpRequest:= CoWinHttpRequest.Create;WinHttpRequest.Open('GET',AURL,False);WinHttpRequest.Send(EmptyParam);结果:= WinHttpRequest.ResponseText;最后WinHTTPRequest:=零;CoUninitialize;结尾;结尾;
它可以在相同的页面中运行(例如: https://www.google.com ),但不适用于同一页面在其他情况下(例如: https://sourceforge.net ),出现错误与服务器的连接异常终止".
我还有其他设置要忘记吗?
我正在使用Delphi 2010.
大多数服务器已经从接受SSL传入流量转向使用TLS协议.Windows 7和8没有定义TLS协议,因此VBA使用SSL发送流量,然后此类服务器将其阻止/丢弃.
您将需要进行两步修补/更新才能修复Windows 7上的问题,
步骤1.获取Microsoft更新:下载相关的(32位或64位用户的Windows版本) Microsoft安全协议更新,如果尚未安装,请进行安装./p>
步骤2.下载Microsoft Easy Fix:从以下位置下载Microsoft轻松修复"更新为将TLS 1.1和TLS 1.2启用为Windows中WinHTTP中的默认安全协议
I import WinHTTP and try execute a request in a https url, like this:
function TForm1.GetPage(AURL: String): String;
var
WinHttpRequest: IWinHTTPRequest;
begin
CoInitialize(nil);
try
WinHttpRequest := CoWinHttpRequest.Create;
WinHttpRequest.Open('GET', AURL, False);
WinHttpRequest.Send(EmptyParam);
Result := WinHttpRequest.ResponseText;
finally
WinHTTPRequest := nil;
CoUninitialize;
end;
end;
It works in same pages (ex: https://www.google.com), but not in others (ex: https://sourceforge.net), with error "The connection with the server was terminated abnormally".
Are there any additional settings I'm forgetting?
I'm using Delphi 2010.
Most servers have migrated away from accepting SSL incoming traffic in favor of TLS protocol. Windows 7 and 8 do not have TLS protocol defined and hence VBA sendss traffic with SSL which is then blocked/dropped by such servers.
You will need to apply a 2-step patch/update to fix this for windows 7,
Step 1. Get Microsoft Update: Download relevant (32-bits or 64-bits of user's Windows version) Microsoft Security Protocol Update and install if not already install.
Step 2. Download Microsoft Easy Fix: Download Microsoft "Easy Fix" from Microsoft Support Article, and execute to set TLS 1.1+ as default.
Source : Update to enable TLS 1.1 and TLS 1.2 as default secure protocols in WinHTTP in Windows
这篇关于WinHTTP-与服务器的连接异常终止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!