使用 .NET 时 MSMQ 间歇性引发 IOException
MSMQ 出现间歇性问题,在发送到队列时生成 System.IO.IOException。我找不到任何关于此信息的信息,因此不确定为什么会发生这种情况(MSDN 文档甚至没有列出这个问题)。正如所说,它是间歇性的,因此调试它很困难,并且不会在开发环境中发生(仅在 QA 中)
堆栈跟踪:
at Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(System.CodeDom.Compiler.CompilerParameters, System.String[])
at Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSourceBatch(System.CodeDom.Compiler.CompilerParameters, System.String[])
at System.Xml.Serialization.Compiler.Compile(System.Reflection.Assembly, System.String, System.Xml.Serialization.XmlSerializerCompilerParameters, System.Security.Policy.Evidence)
at System.Xml.Serialization.TempAssembly.GenerateAssembly(System.Xml.Serialization.XmlMapping[], System.Type[], System.String, System.Security.Policy.Evidence, System.Xml.Serialization.XmlSerializerCompilerParameters, System.Reflection.Assembly, System.Collections.Hashtable)
at System.Xml.Serialization.TempAssembly..ctor(System.Xml.Serialization.XmlMapping[], System.Type[], System.String, System.String, System.Security.Policy.Evidence)
at System.Xml.Serialization.XmlSerializer..ctor(System.Type, System.String)
at System.Messaging.XmlMessageFormatter.Write(System.Messaging.Message, System.Object)
at System.Messaging.Message.AdjustToSend()
at System.Messaging.MessageQueue.SendInternal(System.Object, System.Messaging.MessageQueueTransaction, System.Messaging.MessageQueueTransactionType)
at Test.MSMQWrite.WriteMessageInternal(System.String, System.Object, Boolean)
at Test.Program.Main(System.String[])
WriteMessageInternal 的代码:
private static void WriteMessageInternal(string queueName, object data)
{
using (var queue = new MessageQueue(queueName, false, false, QueueAccessMode.Send))
{
queue.Send(data);
}
}
Having an intermittent issue with MSMQ where it generates System.IO.IOException
when sending to queue. There isn't any information on this info I can find so not sure why it could be happening (MSDN documentation doesn't even list this an issue). As said it is intermittent so debugging it is hard and does not occur on dev environment (only in QA)
Stack Trace:
at Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(System.CodeDom.Compiler.CompilerParameters, System.String[])
at Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSourceBatch(System.CodeDom.Compiler.CompilerParameters, System.String[])
at System.Xml.Serialization.Compiler.Compile(System.Reflection.Assembly, System.String, System.Xml.Serialization.XmlSerializerCompilerParameters, System.Security.Policy.Evidence)
at System.Xml.Serialization.TempAssembly.GenerateAssembly(System.Xml.Serialization.XmlMapping[], System.Type[], System.String, System.Security.Policy.Evidence, System.Xml.Serialization.XmlSerializerCompilerParameters, System.Reflection.Assembly, System.Collections.Hashtable)
at System.Xml.Serialization.TempAssembly..ctor(System.Xml.Serialization.XmlMapping[], System.Type[], System.String, System.String, System.Security.Policy.Evidence)
at System.Xml.Serialization.XmlSerializer..ctor(System.Type, System.String)
at System.Messaging.XmlMessageFormatter.Write(System.Messaging.Message, System.Object)
at System.Messaging.Message.AdjustToSend()
at System.Messaging.MessageQueue.SendInternal(System.Object, System.Messaging.MessageQueueTransaction, System.Messaging.MessageQueueTransactionType)
at Test.MSMQWrite.WriteMessageInternal(System.String, System.Object, Boolean)
at Test.Program.Main(System.String[])
Code for WriteMessageInternal:
private static void WriteMessageInternal(string queueName, object data)
{
using (var queue = new MessageQueue(queueName, false, false, QueueAccessMode.Send))
{
queue.Send(data);
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论