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
尝试另一种方法 –