title: RabbitMQ consumer as windows service
body: <p>i have a rabbitmq consumer application in .net, which runs perfectly as a console applicaiton. but if i deploy that as a windows service i am getting the following error.</p>
  
  <pre><code>RabbitMQ.Client.Exceptions.OperationInterruptedException: The AMQP operation was interrupted: AMQP close-reason, initiated by Application, code=200, text="Goodbye", classId=0, methodId=0, cause=
     at RabbitMQ.Client.Impl.SimpleBlockingRpcContinuation.GetReply()
     at RabbitMQ.Client.Impl.ModelBase.BasicConsume(String queue, Boolean noAck, String consumerTag, Boolean noLocal, Boolean exclusive, IDictionary arguments, IBasicConsumer consumer)
     at RabbitMQ.Client.Impl.ModelBase.BasicConsume(String queue, Boolean noAck, String consumerTag, IDictionary arguments, IBasicConsumer consumer)
     at RabbitMQ.Client.Impl.ModelBase.BasicConsume(String queue, Boolean noAck, String consumerTag, IBasicConsumer consumer)
     at RabbitMQ.Client.Impl.ModelBase.BasicConsume(String queue, Boolean noAck, IBasicConsumer consumer)
     at RbMQSubscriber.RabbitDataService.Subscribe() in C:\Projects\RabbitMqServices\RbMQClient\RabbitDataService.cs:line 72
     at RbMQPublisherService.Service1.backGroundWorker_DoWork(Object sender, DoWorkEventArgs e) in C:\Projects\RabbitMqServices\RbMQSubscriberService\RbMQSubscriberService.cs:line 76
  </code></pre>
  
  <p>and the code failing is </p>
  
  <pre><code>using (_subscription = new Subscription(_channel, _queue, false))
  {
  
     foreach (BasicDeliverEventArgs e in _subscription)
     {
         EventLog.WriteEntry("RBSubService", "in first line", EventLogEntryType.Error);
         yield return e;
     }
  }
  </code></pre>
  
  <p>this code fails only if it is deployed as windows service
  I am using windows7. anyone faced similar problem??</p>