Guest User

Untitled

a guest
Mar 19th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. protected override void OnStart(string[] args)
  2. {
  3.  
  4. MessageQueue msMq = null;
  5. JobModel j = new JobModel();
  6. msMq = new MessageQueue(queueRequestName);
  7. try
  8. {
  9. if (msMq != null)
  10. {
  11. msMq.Formatter = new XmlMessageFormatter(new Type[] { typeof(JobModel) });
  12. var message = (JobModel)msMq.BeginReceive();
  13.  
  14. }
  15. }
  16.  
  17. catch (MessageQueueException ee)
  18. {
  19. Console.Write(ee.ToString());
  20. }
  21. catch (Exception eee)
  22. {
  23. Console.Write(eee.ToString());
  24. }
  25. finally
  26. {
  27. msMq.Close();
  28. }
  29. }
Add Comment
Please, Sign In to add comment