Socrata : 现有连接被远程主机强行关闭
Socrata : An existing connection was forcibly closed by the remote host
我创建了一个应用程序,定期(每个月的第一个星期日)向 data.cms.gov 发送请求以检查 pecos 注册医生。代码运行良好,但几天前就停止工作了。我收到了这个回复 "Unable to read data from transport connection. An existing connection was forcibly closed by the remote host." 谁以前遇到过这个问题或者有人可以帮助解决这个问题吗?我将下面的代码用于我的请求
string end_point = "https://data.cms.gov/resource/qcn7-gc3g.json?$$app_token=myapp_token&npi=";
string cms_uri = end_point + npi;
System.Net.WebClient cms_wc = new System.Net.WebClient();
byte[] bResponse = cms_wc.DownloadData(cms_uri);
string cms_response = System.Text.Encoding.ASCII.GetString(bResponse);
作为安全升级,我们已禁用 TLS 1.0 作为允许的 SSL 协议。我的猜测是这就是触发您断开连接的原因。
https://support.socrata.com/hc/en-us/articles/235267087
您需要指示 .NET 使用 TLS 1.1 或 1.2。您应该能够通过在创建客户端之前添加以下内容来做到这一点:
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
this issue on one of the C# .NET libraries for the SODA API 中有更多信息。
我创建了一个应用程序,定期(每个月的第一个星期日)向 data.cms.gov 发送请求以检查 pecos 注册医生。代码运行良好,但几天前就停止工作了。我收到了这个回复 "Unable to read data from transport connection. An existing connection was forcibly closed by the remote host." 谁以前遇到过这个问题或者有人可以帮助解决这个问题吗?我将下面的代码用于我的请求
string end_point = "https://data.cms.gov/resource/qcn7-gc3g.json?$$app_token=myapp_token&npi=";
string cms_uri = end_point + npi;
System.Net.WebClient cms_wc = new System.Net.WebClient();
byte[] bResponse = cms_wc.DownloadData(cms_uri);
string cms_response = System.Text.Encoding.ASCII.GetString(bResponse);
作为安全升级,我们已禁用 TLS 1.0 作为允许的 SSL 协议。我的猜测是这就是触发您断开连接的原因。
https://support.socrata.com/hc/en-us/articles/235267087
您需要指示 .NET 使用 TLS 1.1 或 1.2。您应该能够通过在创建客户端之前添加以下内容来做到这一点:
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
this issue on one of the C# .NET libraries for the SODA API 中有更多信息。