- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在我的实习期间,我正在制作一个使用 MSMQ 发送消息的应用程序。目前一切正常,除了加密。 (私有(private)数据)
应用程序将自定义对象的列表发送到服务器,并从服务器检索它。但是当我使用:message.UseEncryption = true;单元测试不会运行。
我的代码:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Messaging;
using System.Text;
using System.Threading.Tasks;
namespace MSMQClient
{
public class ClientManager
{
public bool connected { get; private set; }
public string queueLocation { get; private set; }
public Message message { get; private set; }
public MessageQueue messageQueue { get; private set; }
public List<DataContracts.MemoryTransaction> notSentTransactions { get; private set; }
public ClientManager()
{
queueLocation = @".\private$\testqueue";
if (MessageQueue.Exists(queueLocation))
{
MessageQueue.Delete(queueLocation);
}
messageQueue = MessageQueue.Create(queueLocation);
//messageQueue.EncryptionRequired = EncryptionRequired.Body;
}
public bool isConnected()
{
if (messageQueue != null)
{
return true;
}
return false;
}
public bool sendToServer(List<DataContracts.MemoryTransaction> memoryTransactions)
{
try
{
message = new Message();
message.Formatter = new XmlMessageFormatter(new Type[] { typeof(List<DataContracts.MemoryTransaction>) });
//message.UseEncryption = true;
message.Body = memoryTransactions;
message.Label = "MemoryTransList";
message.Priority = MessagePriority.Normal;
messageQueue.Send(message);
return true;
}
catch (Exception ex)
{
Cocosoft.SDK.Logging.TextLogging(ex.ToString());
notSentTransactions = memoryTransactions;
return false;
}
}
}
我找到了 this site并尝试了很多,但我无法让它工作......我想我必须使用接下来的东西:
public bool sendToServer(List<DataContracts.MemoryTransaction> memoryTransactions)
{
try
{
message = new Message();
message.Body = ... //memoryTransactions
message.Label = ... //"MemoryTransList"
message.Priority = ... //Priority.Normal
message.Formatter = ... //new XmlMessageFormatter(new Type[] { typeof(List<DataContracts.MemoryTransaction>) });
message.UseEncryption = ... //true
message.ConnectorType = ... //???
message.EncryptionAlgorithm = ... //EncryptionAlgorithm.Rc2
message.DestinationSymmetricKey = ...//???
messageQueue.Send(message);
return true;
}
catch (Exception ex)
{
notSentTransactions = memoryTransactions;
return false;
}
}
谁能帮帮我?我错过了什么吗?
但是 Cocosoft SDK 将其保存在 logging.txt 中:
翻译:指定的格式名称不支持请求的操作。例如,不能删除直接队列格式名称。
System.Messaging.MessageQueueException (0x80004005): De opgegeven indelingsnaam ondersteunt de gevraagde bewerking niet. Een directe wachtrij-indelingsnaam kan bijvoorbeeld niet worden verwijderd.
bij System.Messaging.MessageQueue.SendInternal(Object obj, MessageQueueTransaction internalTransaction, MessageQueueTransactionType transactionType)
bij System.Messaging.MessageQueue.Send(Object obj)
bij MSMQClient.ClientManager.sendToServer(List`1 memoryTransactions) in d:\StageGeert\UnitTestStage\MSMQClient\ClientManager.cs:regel 96
最佳答案
我找到了解决办法!我使用的是本地版本的 MSMQ。但我必须在 Azure 中实现,所以我使用了 Azure 服务总线。这与本地消息队列有点不同。但多亏了 Azure Service Bus,问题解决了!微软干得好!
关于c# - 如何加密msmq消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33276505/
我刚刚和一位 Microsoft MVP 聊天,他告诉我 MSMQ 已经过时了。这是真的?那么 SOA 的基础设施是什么??? 最佳答案 好吧,他们发布了一个带有 Vista 的新版本 (4.0),它
只是想确认如何将消息发送到远程事务性消息队列。 假设我有两台机器,A 和 B。 机器 A 有一个用于接收消息的事务队列。 Windows 服务监视此队列并对数据执行某些操作(将其保存到 SQL Ser
我一直看到documentation表示不可能发送到事务范围之外的远程事务 msmq 队列。我发现这很难相信,因为我认为我已经这样做了好几个星期了。我有一个小应用程序,它将消息发布到事务性的远程队列。
我正在使用 MSMQ 传输一个 byte 数组。 格式化程序是一个 BinaryMessageFormatter。 目标队列是私有(private)队列,我正在使用直接 TCP 通信。 目标机器在不同
有人可以为我指出一些关于为队列集群设置 MSMQ 的好资源吗?我有兴趣帮助: 实际设置集群MSMQ节点,并使其运行 设置应用程序以将消息发送到集群队列。 设置应用程序(至少 2 个)以从同一个集群队列
我是消息传递的新手,有点不清楚 MSMQ 是否可以为事务队列传递乱序消息。我想这一定是因为如果一条消息没有得到正确处理(并且因为我们将使用多个“竞争消费者”),那么其他消费者可以继续处理消息,同时将失
我们使用 BizTalk Server 通过 MSMQ 发送消息。接收系统要求每条消息都将扩展属性设置为 guid(作为字节数组)。 MSDN 记录了 MSMQMessage here 的 Exten
我正在做 NServiceBus 网站 ( http://docs.particular.net/samples/step-by-step/ ) 上的示例,当我在 Visual Studio 中运行时
我们有一个基于 NServiceBus 的 Pub/Sub 系统,我们有间歇性问题,消息无限期地卡在发布者传出队列上,而不是被传输到订阅者输入队列。 注意事项: 当我们重新启动发布者服务和订阅者服务时
当您向远程队列发送消息时,会在您自己的机器上创建一个临时传出队列。这是否意味着如果您自己的机器上没有安装MSMQ,您就不能使用远程队列? 最佳答案 你是对的。如果你自己的机器上没有安装 MSMQ,你就
我正在尝试使用以下路径连接到远程私有(private) MSMQ 队列: "FormatName:DIRECT=OS:remoteMachineName\Private$\MyQueue" 我收到以下
据我从文档中看到,您应该检查消息队列中是否有消息的方法是使用 Peek 方法。然后,您依靠它失败并返回 MessageQueueException 来告诉您队列为空。 public bool
我正在尝试使用主机文件中的别名指向包含 MSMQ 的服务器。如果我在 MSMQ 路径中指定实际服务器名称,则一切正常: var queue = new MessageQueue("FormatName
是否可以直接从队列中以字符串形式读取消息(与您在计算机管理 MSC 管理单元中查看 MSMQ 消息时看到的消息正文相同),以便我可以自己将其保存到数据库中?我希望能够存储它以便稍后重播而不会丢失任何数
有没有办法清除传出队列。似乎我无法使用 MMC 管理单元完成此操作,当我尝试在代码中清除它时出现错误 Format name is invalid将消息发送到的计算机不存在,因此它们永远不会被发送,但
有一个名为 queue1 的公共(public)队列在机器 A 上。我想从机器 B 向这个队列发送消息。为了实现这一点,我编写了那个 c# 代码。 if (MessageQueue.Exists("m
是否有某种标准配置设置、服务或工具可以接受来自一个队列的消息并将其移至另一个队列?自动处理死消息问题,并提供一些重试能力?我想这就是“MSMQ 消息路由”所做的事情,但似乎找不到有关它的文档(Wind
我正在尝试创建一个 MSMQ 解决方案,对于某些消息,我希望它们仅在下午 6 点之后处理,那么 MSMQ 中是否有一种方法可以在 Future 中处理该消息? 最佳答案 队列是一种先进先出的数据结构。
我们的系统中有许多 MSMQ 队列,包括私有(private)队列和公共(public)队列。有时,从队列中读取的 Windows 服务会崩溃,因此消息会在该队列中堆积。一旦队列达到一定大小(可能是
我们在使用 NServiceBus 的负载平衡的高容量环境中遇到了 MSMQ 问题。 我们的环境如下所示: 1 F5 通过循环分配网络流量到 6 个应用服务器。这 6 个服务器中的每一个都使用一个 B
我是一名优秀的程序员,十分优秀!