WCF MSMQ message processed multiple times
I have a WCF program that is being communicated with via MSMQ. For some reason several messages are being processed multiple times for no apparent reason. No errors are being thrown and I've confirmed that the application enters and exits the operationBehaivior without any errors being thrown.
For example, I'll send 1 message via MSMQ, the app will receive it and successfully process it, then for some reason reprocess it again (sometimes multiple times, sometimes no reprocessing)
Here are the relevant behavior's and contracts being defined:
[ServiceContract]
public interface IApp
{
[OperationContract(IsOneWay = true)]
void ProcessMessage(List<AppData> appInfo);
}
[ServiceBehavior(InstanceContextMode=InstanceContextMode.Single)]
public class ProcessInfo : IApp
{
[OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]
public void ProcessMessage(List<AppData> appInfo)
{
try
{
app logic
}
开发者_开发技巧 catch(Exception e)
{
}
}
It looks as though the MSMQ messages that are processed multiple times have an aborted count > 0 or are put in the retry queue, however, I never receive an error as to why this happens.
Any idea as to why this would happen would be much appreciated.
You found out that your problem was the binding timeouts were being exceeded and you asked why you weren't seeing any exceptions in your client or service code. Here's the explination for that:
Client wise, the message is one way and was successfully delivered to the queue. That's all that matters from the client perspective. The client will never see that there was an exception in processing the message on the server side.
Service wise, you weren't seeing exceptions in your code because the timeout is handled at the WCF runtime level. Your code completes its execution normally (WCF isn't going to abort the executing thread or anything), but as far as the WCF runtime is concerned it took too long and so the message delivery needs to be retried again. That said, you most definitely will see errors in the event log and, if enabled, the service trace logs indicating that a timeout occurred.
精彩评论