Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
499 views
in Technique[技术] by (71.8m points)

system.messaging - The specified format name does not support the requested operation. For example, a direct queue format name cannot be deleted

I'm trying to send a message to a queue using a Message object and am getting the error

The specified format name does not support the requested operation. For example, a direct queue format name cannot be deleted.

Here is the code.

        Order ord = new Order(new Guid(), "Smith & Smith");

        Message orderMessage = new Message(ord);
        orderMessage.UseEncryption = true;
        orderMessage.EncryptionAlgorithm = EncryptionAlgorithm.Rc2;
        orderMessage.Recoverable = true;
        orderMessage.Priority = MessagePriority.VeryHigh;
        orderMessage.TimeToBeReceived = TimeSpan.FromHours(1);
        orderMessage.UseJournalQueue = true;
        orderMessage.Body = "Test Encryption";
        queue.Send(orderMessage, "Encrypted Order");

Any help with this is appreciated.

Tom

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Did you ever solve this? I came across this problem myself and found out I needed to use (just like the error says) a different format name.

The strange thing was that if I set UseAuthentication property using the MQ certificate, then it worked. But if I also wanted to set UseEncryption, then it did not work.

You do not specify your queue/server setup/formats, but I suspect you're trying to send from one machine to another machine's public queue within the same domain, using DIRECT formatname? As the MQ Manager will use the domain AD to lookup the certificate and queue details, it raises an exception as the format name is invalid (not the same as specified in the AD). So instead of using the direct format, use the queue ID to define the formatname. I switched this:

"FormatName:Direct=TCP:111.222.1.22your_public_queue"

with this:

"FormatName:PUBLIC=7EB2A53C-7593-462C-A568-5A0EFA26D91D" 

Now it worked. You can find your queue ID by right-clicking your queue on the receiver machine and then go to Properties->General and see the value specified in field "ID".


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...