首页 > 解决方案 > 测量协议 - System.Net.WebException:底层连接已关闭:接收时发生意外错误

问题描述

我对 Measurement Protocol 有环境问题。我编写了对 Google Analytics 的服务器端调用,并以此为指导发送事件: https ://gist.github.com/0liver/11229128

这适用于 3 个环境,但在第 4 个环境中,我收到此错误:

System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. ---> 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.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) --- End of inner exception stack trace --- at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size) at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead) --- End of inner exception stack trace --- at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context) at System.Net.HttpWebRequest.GetRequestStream() at ASP.abc_media_test_tlstest_aspx.GATrackEvent2(String type, String category, String action, String label, String cid, Nullable`1 value) at ASP.abc_media_test_tlstest_aspx.btnSubmit_Click(Object sender, EventArgs e)

我认为这可能是 WAF 问题,但它不是处于阻塞模式。我也尝试过明确设置 TLS 版本。没有任何效果。我已经没有想法了。有人有吗?

标签: google-analyticsmeasurement-protocol

解决方案


推荐阅读