Zyan通信框架-由于消息被加密,公钥发生了更改
本文关键字:加密 公钥 发生了 消息 框架 通信 于消息 Zyan | 更新日期: 2023-09-27 18:24:11
我正试图使用Zyan通信框架使用TCP双工通道设置一个简单的RPC客户端/服务器通信,但当客户端尝试连接到服务器时,我不断收到相同的错误"由于消息加密,公钥已更改"。
我已经在客户端和服务器中明确地将加密设置为false,所以我看不出出现该错误的原因。
出于演示的目的,我设置了一个示例来演示问题
版本:
- NET版本4.5.2
- Zyan 2.6.2
using System;
using System.Threading;
using Zyan.Communication;
using Zyan.Communication.Protocols.Tcp;
namespace StackOverflowMinimalSample
{
public interface ISampleService
{
string GetGreeting();
}
public class SampleService : ISampleService
{
public string GetGreeting()
{
return "Hello World";
}
}
class Program
{
static void Main(string[] args)
{
int port = 5252;
Thread serverThread = new Thread(() =>
{
var protocol = new TcpDuplexServerProtocolSetup(port){Encryption = false};
using (var tcpHost = new ZyanComponentHost("TCPCommunication", protocol))
{
tcpHost.RegisterComponent<ISampleService, SampleService>();
Console.WriteLine("Press [Enter] to exit");
Console.ReadLine();
}
})
{IsBackground = true};
serverThread.Start();
Thread clientThread = new Thread(() =>
{
// Sleep for a while to give time to the server
Thread.Sleep(5000);
var protocol = new TcpDuplexClientProtocolSetup(encryption: false);
var url = protocol.FormatUrl("127.0.0.1", port, "TCPCommunication");
try
{
using (var connection = new ZyanConnection(url))
{
ISampleService proxy = connection.CreateProxy<ISampleService>();
string serverMessage = proxy.GetGreeting();
Console.WriteLine("Server message: " + serverMessage);
}
}
catch (Exception e)
{
// This will throw here.
Console.WriteLine("Exception caught: " + e.Message);
}
})
{IsBackground = true};
clientThread.Start();
Console.WriteLine("Press [Enter] to exit");
Console.ReadLine();
}
}
}
https://zyan.codeplex.com/discussions/453233
"您正在使用双工TCP通道在同一AppDomain内进行连接。TcpEx通道在设计上不支持此功能。
请使用IpcBinary通道或NullChannel在同一应用程序域内进行连接。"