Sayfayı Yazdır | Pencereyi Kapat

System.IO.IOException: Unable to write data to....

Nereden Yazdırıldığı: Datakent
Kategori: Diğer bölümler
Forum Adı: C# & ASP.NET
Forum Tanımlaması: C# ve ASP.NET ile ilgili soru / sorun ve paylaşım bölümü
URL: http://forum.datakent.com/forum_posts.asp?TID=2878
Tarih: 28.Mart.2024 Saat 14:54


Konu: System.IO.IOException: Unable to write data to....
Mesajı Yazan: murat turan
Konu: System.IO.IOException: Unable to write data to....
Mesaj Tarihi: 29.Nisan.2016 Saat 10:56
İŞLEM:
HTTPS üzerinden webservis'e erişimde oluşan hata. / connect https webservices


HATA DETAYI:
************** Exception Text **************
System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Unable to write data to the transport connection: Varolan bir bağlantı uzaktaki bir ana bilgisayar tarafından zorla kapatıldı. ---> System.Net.Sockets.SocketException: Varolan bir bağlantı uzaktaki bir ana bilgisayar tarafından zorla kapatıldı
   at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)

   
ÇÖZÜM:
1. Bağlantı sağlanan sayfa için bağlantı şekli öğrenilmelidir.
Hangi bağlantı türü ile güvenlik sağlanmaktadır?
  SSL3? TLS10? TLS11? TLS12?
Bunu FireFox'da sayfa bilgisi kısmında gücenlik sekmesinden edinebilirsiniz.
Bu sekmeye girdiğinizde sayfa sonunda TEKNİK DETAY kısmında bilgi sunulmaktadır.
2. Öğrenilen bağlantı tipi doğrultusunda kodun en başına aşağıdakini eklemeniz sorunu çözebilir.

System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

VEYA

System.Net.ServicePointManager.SecurityProtocol = default:System.Net.SecurityProtocolType.Ssl3 | System.Net.SecurityProtocolType.Tls;

Not: Tls11/Tls12 .net v4.5 ve üzeri gerektiriyor zira v4 de Tls11 ve Tls12 yi göremedim.
 
 
Solution:
1. Check Connection Encrypted type: SSL3? TLS10? TLS11? TLS12?
for this may be use firefox > page Info > Security Tab > Technical Details
2. add bellow line app load

System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

or

System.Net.ServicePointManager.SecurityProtocol = default:System.Net.SecurityProtocolType.Ssl3 | System.Net.SecurityProtocolType.Tls;

note: Tls11/Tls12 request .net >= v4.5 ??
  

KeyWords:
System.IO.IOException: Unable to write data to the transport connection: Varolan bir bağlantı uzaktaki bir ana bilgisayar tarafından zorla kapatıldı ; System.IO.IOException: Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host



-------------
http://www.kasatakip.com - Kasa Takip  |  http://www.caritakip.com - Cari Takip  |  http://www.evraktakip.com - Evrak Takip  |  http://www.etasqlmobil.com - ETA SQL Mobil



Sayfayı Yazdır | Pencereyi Kapat