开发者

RabbitMQ consumer as windows service

开发者 https://www.devze.com 2023-04-04 04:42 出处:网络
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.

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.

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 co开发者_如何学PythonnsumerTag, 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

and the code failing is

using (_subscription = new Subscription(_channel, _queue, false))
{

   foreach (BasicDeliverEventArgs e in _subscription)
   {
       EventLog.WriteEntry("RBSubService", "in first line", EventLogEntryType.Error);
       yield return e;
   }
}

this code fails only if it is deployed as windows service I am using windows7. anyone faced similar problem??


Found the issue, the problem is due to the Task, Created a new Thread and Executed Subcription code in that. It's working fine

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号