Guest User

Untitled

a guest
Mar 19th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. MyQueue = MessageQueue.GetPrivateQueuesByMachine(System.Environment.GetEnvironmentVariable("COMPUTERNAME"))
  2. .Where(q => q.QueueName == QueueName.Substring(2)).First();
  3.  
  4.  
  5.  
  6. try
  7. {
  8. MyQueue.SetPermissions("Everyone", MessageQueueAccessRights.FullControl, AccessControlEntryType.Set);
  9. MyQueue.Formatter = new XmlMessageFormatter(new String[] { "System.String,mscorlib" });
  10. // Create a transaction.
  11. MessageQueueTransaction messageQueueTransaction = new MessageQueueTransaction();
  12. }
  13.  
  14. catch (MessageQueueException e)
  15. {
  16. // Handle nontransactional queues.
  17. if (e.MessageQueueErrorCode ==
  18. MessageQueueErrorCode.TransactionUsage)
  19. {
  20. Console.WriteLine("Queue is not transactional.");
  21. }
  22. // Else catch other sources of a MessageQueueException.
  23.  
  24. System.Xml.XmlException
  25. HResult=0x80131940
  26. Message=Root element is missing.
  27. Source=System.Xml
  28. StackTrace:
  29. at System.Xml.XmlTextReaderImpl.Throw(Exception e)
  30. at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
  31. at System.Xml.XmlTextReaderImpl.Read()
  32. at System.Xml.XmlTextReader.Read()
  33. at System.Xml.XmlReader.MoveToContent()
  34. at System.Xml.XmlReader.IsStartElement(String localname, String ns)
  35. at System.Xml.Serialization.XmlSerializer.CanDeserialize(XmlReader
  36. xmlReader)
  37. at System.Messaging.XmlMessageFormatter.Read(Message message)
  38. at System.Messaging.Message.get_Body()
  39. at ReadQueueNotif.Program.Main(String[] args) in
  40. C:UsersR34pe7sourcereposReadQueueNotifReadQueueNotifProgram.cs:line
  41. 56
Add Comment
Please, Sign In to add comment