使用signalr和Java客户端将json对象发送到.net服务器
我正在使用Signalr5.0,我正在尝试从Android客户端发送JSON。我已经调查过了。但这对我来说不起作用,我在测试“{”Id:“123123”,“ReceviedDateTime:“2020年11月23日12:50:55 PM”,“RepliedDatetime:“2020年11月23日12:50:55 PM”}”中得到json时,发送就起作用了,但从未调用Pong方法。补充 services.AddSignalR().AddJsonProtocol();创业中 乒乓球模型:使用signalr和Java客户端将json对象发送到.net服务器,java,c#,asp.net-core-signalr,Java,C#,Asp.net Core Signalr,我正在使用Signalr5.0,我正在尝试从Android客户端发送JSON。我已经调查过了。但这对我来说不起作用,我在测试“{”Id:“123123”,“ReceviedDateTime:“2020年11月23日12:50:55 PM”,“RepliedDatetime:“2020年11月23日12:50:55 PM”}”中得到json时,发送就起作用了,但从未调用Pong方法。补充 services.AddSignalR().AddJsonProtocol();创业中 乒乓球模型: publ
public class PongModel
{
public int Id { get; set; }
public int DeviceId { get; set; }
public string PhoneNumber { get; set; }
public DateTime SendDatetime { get; set; }
public DateTime ReceviedDateTime { get; set; }
public DateTime RepliedDatetime { get; set; }
}
Java代码:
方法(.net核心5)
不序列化直接传递对象示例:hubConnection.send(“Pong”,p); 添加此项以获取绑定错误: “Microsoft.AspNetCore.signal”:“调试”,
“Microsoft.AspNetCore.Http.Connections”:“Debug”不序列化直接传递对象示例:hubConnection.send(“Pong”,p); 添加此项以获取绑定错误: “Microsoft.AspNetCore.signal”:“调试”,
“Microsoft.AspNetCore.Http.Connections”:“Debug”您的服务器日志应该会澄清这个问题。到模型的映射可能不正确。例如,在您的json Id中是字符串,但在模型类中是int.Dates格式也可能有问题是的,它可以工作!您的服务器日志应该可以澄清这个问题。到模型的映射可能不正确。例如,在您的json Id中是字符串,但在模型类中是int.Dates格式也可能有问题是的,它可以工作!
public void Pong(PongModel pongModel)
{
}
public void Send(string test)
{
}