Unable to write data to the transport connection: 远程主机强迫关闭了一个现有的连接。.
at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.ConnectStream.InternalWrite(Boolean async, Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
at System.Net.ConnectStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at Aliyun.OSS.Util.IoUtils.WriteTo(Stream orignStream, Stream destStream, Int64 totalSize)
at Aliyun.OSS.Common.Communication.ServiceClientImpl.SetRequestContent(HttpWebRequest webRequest, ServiceRequest serviceRequest, Boolean async, OssAction asyncCallback)
at Aliyun.OSS.Common.Communication.ServiceClientImpl.SendCore(ServiceRequest serviceRequest, ExecutionContext context)
at Aliyun.OSS.Common.Communication.ServiceClient.Send(ServiceRequest request, ExecutionContext context)
at Aliyun.OSS.Common.Communication.RetryableServiceClient.SendImpl(ServiceRequest request, ExecutionContext context, Int32 retryTimes)
at Aliyun.OSS.Common.Communication.RetryableServiceClient.Send(ServiceRequest request, ExecutionContext context)
at Aliyun.OSS.Commands.OssCommand.Execute()
at Aliyun.OSS.OssClient.PutObject(String bucketName, String key, Stream content, ObjectMetadata metadata)
at Aliyun.OSS.OssClient.PutObject(String bucketName, String key, Stream content)
at WindowsFormsApplication1.Form1.button3_Click(Object sender, EventArgs e)
OSS.=====Exception发送图片异常====System.IO.IOException: 无法将数据写入传输连接: 远程主机强迫关闭了一个现有的连接。。 ---> System.Net.Sockets.SocketException: 远程主机强迫关闭了一个现有的连接。 在 System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) 在 System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size) --- 内部异常堆栈跟踪的结尾 --- 在 System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size) 在 System.Net.Security._SslStream.StartWriting(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest) 在 System.Net.Security._SslStream.ProcessWrite(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest) 在 System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size) 在 System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size) 在 System.Net.ConnectStream.InternalWrite(Boolean async, Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state) 在 System.Net.ConnectStream.Write(Byte[] buffer, Int32 offset, Int32 size) 在 Aliyun.OSS.Util.IoUtils.WriteTo(Stream orignStream, Stream destStream, Int64 totalSize) 在 Aliyun.OSS.Common.Communication.ServiceClientImpl.SetRequestContent(HttpWebRequest webRequest, ServiceRequest serviceRequest, Boolean async, OssAction asyncCallback) 在 Aliyun.OSS.Common.Communication.ServiceClientImpl.SendCore(ServiceRequest serviceRequest, ExecutionContext context) 在 Aliyun.OSS.Common.Communication.ServiceClient.Send(ServiceRequest request, ExecutionContext context) 在 Aliyun.OSS.Common.Communication.RetryableServiceClient.SendImpl(ServiceRequest request, ExecutionContext context, Int32 retryTimes) 在 Aliyun.OSS.Common.Communication.RetryableServiceClient.Send(ServiceRequest request, ExecutionContext context) 在 Aliyun.OSS.Commands.OssCommand.Execute() 在 Aliyun.OSS.Commands.OssCommand`1.Execute() 在 Aliyun.OSS.OssClient.PutObject(PutObjectRequest putObjectRequest) 在 Aliyun.OSS.OssClient.PutObject(String bucketName, String key, Stream content, ObjectMetadata metadata) 在 Aliyun.OSS.OssClient.PutObject(String bucketName, String key, String fileToUpload, ObjectMetadata metadata) 在 Aliyun.OSS.OssClient.PutObject(String bucketName, String key, String fileToUpload) 在 Aliyun.OSS.Sdk.JSST.SDK.PutObject.PutObjectFromFile(String bucketName, String key, String localFilePath, Result& resultMessage)
OSS的安全防护有防盗链、ACL权限控制和跨域控制的功能,是没有根据IP进行限制的,从上面的情况上看是该用户到OSS的连接被reset导致无法连接,这种问题如果可以复现的话建议可以提交工单让阿里云的工程师和该用户一起抓包看下是哪里发的reset包导致连接中断的。
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。