根据MSDN,可以通过REST API提交Brokered Message,这个代理消息可以将Properties键值对作为消息的一部分.我已经能够提交Brokered消息,但是当我收到消息时,消息中的Properties字段不会被填充.我必须错误地编码Properties JSON.
这是代码片段
WebClient webClient = new WebClient();
webClient.Headers[HttpRequestHeader.Authorization] = _token;
webClient.Headers["Content-Type"] = "application/atom+xml;type=entry;charset=utf-8";
Guid messageId = Guid.NewGuid();
webClient.Headers["BrokerProperties"] = @"{""MessageId"": ""{" + messageId.ToString("N") + @"}"", ""TimeToLive"" : 900, ""Properties"": [{""Key"" : ""ProjectId"", ""Value"" : """ + message.ProjectId + @"""}]}";
// Serialize the message
MemoryStream ms = new MemoryStream();
DataContractSerializer ser = new DataContractSerializer(typeof(RespondentCommitMessage));
ser.WriteObject(ms, message);
byte[] array = ms.ToArray();
ms.Close();
byte[] response = webClient.UploadData(fullAddress, "POST", array);
string responseStr = Encoding.UTF8.GetString(response);
Run Code Online (Sandbox Code Playgroud)
有没有人有使用BrokerProperties HTTP标头提交BrokeredMessage的示例?
我可以在特定的计算机上执行以下命令,它可以返回多个目标计算机上的进程列表,但在一台计算机上返回"无法连接到远程计算机"错误.
get-process -ComputerName 192.168.1.101
什么会阻止我使用PowerShell从远程计算机获取进程列表?