The client and server cannot communicate, because they do not possess a common algorithm

alattin (16999) 6 yıl önce sordu

smtpclient ile email gönderen, C# ile geliştirilmiş uygulama email göndermemeye ve şu hatayı vermeye başladı:

The client and server cannot communicate, because they do not possess a common algorithm

The client and server cannot communicate, because they do not possess a common algorithm hatasının çözümü nedir?

Toplam 1 cevap


alattin (16999) 6 yıl önce cevapladı

The client and server cannot communicate, because they do not possess a common algorithm hatası SSL ile güvenli bağlantı yapılan uygulamalarda karşınıza çıkabilir. Hatanın temel sebebi kullanılan TLS sürümünün uyuşmaması olabilir.

Örneğin sunucunuz TLS 1.0 desteklemiyorsa, güvenlik sebebi ile TLS 1.0'ı kapattıysanız karşınıza The client and server cannot communicate, because they do not possess a common algorithm hatası çıkabilir.

Çünkü uygulamanız .NET Framework 4.5 altında çalışıyorsa, .NET Framework 4.5 varsayılan olarak TLS 1.0 kullanır. Çözüm için kodlarınıza şu satırı ekleyebilirsiniz:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; 

Eğer uyguamanız .NET Framework 4.0 altında çalışıyorsa:

 

ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; 

satırını ekleyin.

Ayrıca .NET Framework 4.6 varsayılan olarak TLS 1.2 kullanmaktadır. Uygulamanızı 4.6'ya yükselterek de sorunu çözebilirsiniz.

Çözüm 2: .NET Framework 4.6 üzeri kullanıyorsanız ve yine de .NET Framework 4.6 The client and server cannot communicate, because they do not possess a common algorithm hatası alıyorsanız

web.config dosyanıza   <system.web> içerisine şu satırı ekleyin.


    <httpRuntime targetFramework="4.8" />

Burada 4.8 yerinde kullandığınız Framework sürümünü belirtmelisiniz. Bunu yaptığınızda uygulamanız zorunlu olarak burada belirttiğiniz sürümde çalışmaya zorlanacaktır.