Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MyQueue = MessageQueue.GetPrivateQueuesByMachine(System.Environment.GetEnvironmentVariable("COMPUTERNAME"))
- .Where(q => q.QueueName == QueueName.Substring(2)).First();
- try
- {
- MyQueue.SetPermissions("Everyone", MessageQueueAccessRights.FullControl, AccessControlEntryType.Set);
- MyQueue.Formatter = new XmlMessageFormatter(new String[] { "System.String,mscorlib" });
- // Create a transaction.
- MessageQueueTransaction messageQueueTransaction = new MessageQueueTransaction();
- }
- catch (MessageQueueException e)
- {
- // Handle nontransactional queues.
- if (e.MessageQueueErrorCode ==
- MessageQueueErrorCode.TransactionUsage)
- {
- Console.WriteLine("Queue is not transactional.");
- }
- // Else catch other sources of a MessageQueueException.
- System.Xml.XmlException
- HResult=0x80131940
- Message=Root element is missing.
- Source=System.Xml
- StackTrace:
- at System.Xml.XmlTextReaderImpl.Throw(Exception e)
- at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
- at System.Xml.XmlTextReaderImpl.Read()
- at System.Xml.XmlTextReader.Read()
- at System.Xml.XmlReader.MoveToContent()
- at System.Xml.XmlReader.IsStartElement(String localname, String ns)
- at System.Xml.Serialization.XmlSerializer.CanDeserialize(XmlReader
- xmlReader)
- at System.Messaging.XmlMessageFormatter.Read(Message message)
- at System.Messaging.Message.get_Body()
- at ReadQueueNotif.Program.Main(String[] args) in
- C:UsersR34pe7sourcereposReadQueueNotifReadQueueNotifProgram.cs:line
- 56
Add Comment
Please, Sign In to add comment