You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in the web(mvc) action I use PublishAsync method ,sometimes it happens error ,error message is
EasyNetQ.EasyNetQException: PersistentConnection: Attempt to create a channel while being disconnected.
在 EasyNetQ.PersistentConnection.CreateModel()
在 EasyNetQ.Producer.PersistentChannel.OpenChannel()
在 EasyNetQ.Producer.PersistentChannel.InvokeChannelActionInternal(Action1 channelAction, DateTime startTime) 在 EasyNetQ.Producer.PersistentChannel.InvokeChannelAction(Action1 channelAction)
在 EasyNetQ.Producer.ClientCommandDispatcherSingleton.<>c__DisplayClass5`1.b__2()
my code is
// POST api/values
public HttpResponseMessage Post([FromBody] TeslaOrder order)
{
using (var messageBus = RabbitHutch.CreateBus("host=localhost;username=zhujinhu;password=123456;publisherConfirms=true;timeout=60"))
{
//messageBus.Publish(order);
messageBus.PublishAsync(order).ContinueWith(task =>
{
// this only checks that the task finished
// IsCompleted will be true even for tasks in a faulted state
// we use if (task.IsCompleted && !task.IsFaulted) to check for success
if (task.IsCompleted && !task.IsFaulted)
{
Console.Out.WriteLine("{0} Completed", 11);
}
if (task.IsFaulted)
{
Console.Out.WriteLine("\n\n");
Console.Out.WriteLine(task.Exception);
Console.Out.WriteLine("\n\n");
}
});
}
return Request.CreateResponse(HttpStatusCode.Created);
}
when debug it go into task.IsFaulted。
The text was updated successfully, but these errors were encountered:
Also, you're not returning the task from your controller action, so it executes outside the context of your controller action, that is not a good idea.
my easynetq is v0.50.12.407.
in the web(mvc) action I use PublishAsync method ,sometimes it happens error ,error message is
EasyNetQ.EasyNetQException: PersistentConnection: Attempt to create a channel while being disconnected.
在 EasyNetQ.PersistentConnection.CreateModel()
在 EasyNetQ.Producer.PersistentChannel.OpenChannel()
在 EasyNetQ.Producer.PersistentChannel.InvokeChannelActionInternal(Action
1 channelAction, DateTime startTime) 在 EasyNetQ.Producer.PersistentChannel.InvokeChannelAction(Action
1 channelAction)在 EasyNetQ.Producer.ClientCommandDispatcherSingleton.<>c__DisplayClass5`1.b__2()
my code is
// POST api/values
public HttpResponseMessage Post([FromBody] TeslaOrder order)
{
using (var messageBus = RabbitHutch.CreateBus("host=localhost;username=zhujinhu;password=123456;publisherConfirms=true;timeout=60"))
{
//messageBus.Publish(order);
messageBus.PublishAsync(order).ContinueWith(task =>
{
// this only checks that the task finished
// IsCompleted will be true even for tasks in a faulted state
// we use if (task.IsCompleted && !task.IsFaulted) to check for success
if (task.IsCompleted && !task.IsFaulted)
{
Console.Out.WriteLine("{0} Completed", 11);
}
if (task.IsFaulted)
{
Console.Out.WriteLine("\n\n");
Console.Out.WriteLine(task.Exception);
Console.Out.WriteLine("\n\n");
}
});
}
return Request.CreateResponse(HttpStatusCode.Created);
}
when debug it go into task.IsFaulted。
The text was updated successfully, but these errors were encountered: