使用实体框架,在使用代码优先的迁移文件时,它会生成.resx
文件 (xml),其中包含一个名为 的数据字段Target
:
<data name="Target" xml:space="preserve">
<value>H4sIAAAAAAAEAO ... ICAA==</value>
</data>
Run Code Online (Sandbox Code Playgroud)
该字段是哪种格式?将==
在数据的结尾让觉得是的base64,但解码时,它看起来就像是二进制数据。有人知道数据的结构/格式吗?
我无法使消息从后面的代码发送给一个特定用户。Clients.All
有效,Clients.AllExcept(userId)
有效,但无效Client.User(userId)
。
我的中心:
public class MessagingHub : Hub
{
public override Task OnConnected()
{
var signalRConnectionId = Context.ConnectionId;
// for testing purpose, I collect the userId from the VS Debug window
System.Diagnostics.Debug.WriteLine("OnConnected --> " + signalRConnectionId);
return base.OnConnected();
}
}
Run Code Online (Sandbox Code Playgroud)
我的控制器从后面的代码发送消息:
public void PostMessageToUser(string ConnectionId)
{
var mappingHub = GlobalHost.ConnectionManager.GetHubContext<MessagingHub>();
// doesn't works
mappingHub.Clients.User(ConnectionId).onMessageRecorded();
// doesn't works
mappingHub.Clients.Users(new List<string>() { ConnectionId }).onMessageRecorded();
// works
mappingHub.Clients.All.onMessageRecorded();
// works (?!)
mappingHub.Clients.AllExcept(ConnectionId).onMessageRecorded();
}
Run Code Online (Sandbox Code Playgroud)
我的集线器是如何在 JS 上初始化的:
var con, …
Run Code Online (Sandbox Code Playgroud)