0
我試圖從客戶端發送XML到服務器。我使用這個using System.Security.Cryptography.X509Certificates;
並得到AuthenticateClient
中的異常。唯一的例外是服務器(java)無法從客戶端(c#)使用SSL連接接收XML
AutenticationException被抓,到SSPI調用失敗,請參見內部 例外。
這是我的代碼:
public static SslStream OpenSSL(string _IP, int _port)
{
try
{
TcpClient client = new TcpClient(_IP, _port);
// Create a secure stream
SslStream sslStream = new SslStream(client.GetStream(), false,
new RemoteCertificateValidationCallback(ValidateServerCertificate), null);
if (sslStream != null)
{
sslStream.AuthenticateAsClient(_IP);
}
return sslStream;
}
catch (Exception _e)
{
Util.Log.Track(Config.System.LogMode.UTIL, "Comms.Handler.OpenSSL: exception = " + _e.ToString());
return null;
}
}
我可以連接到服務器,但是服務器將不會收到XML。我被困在這裏2天了,有人知道這個問題有什麼問題嗎?
注:我用VS2010(客戶端)和Eclipse火星的Linux操作系統(服務器)
謝謝回答。但它不起作用,服務器仍然沒有收到XML – Mirza
嘗試另一種方法 –