I am trying to create a WCF service that will accompany hundreds of downloads and conversions. I initialized MSMQ with a transaction queue that accepts messages from an ASP.NET web application.
My question after a lot of research on the internet is how to manage a lengthy process in the WCF service method that manages the MSMQ message.
The problem is that when loading with small sizes, the process ends soon, and the return area returns to the MSMQ service, but if the download size is large and it needs to load 3/4 minutes, but the MSMQ service resends the MSG to the WCF service, and I have duplicate downloads.
I think this is a timeout problem, but I already tried to configure my app.config host without success.
<netMsmqBinding> <binding name="OrderServiceMsmqBinding" maxRetryCycles="1" receiveRetryCount="1" retryCycleDelay="00:05:20" deadLetterQueue="System" receiveErrorHandling="Move" exactlyOnce="true" durable="true" receiveTimeout="00:10:00" sendTimeout="00:20:00" timeToLive="1.00:00:00" useMsmqTracing="true"> <security mode="None"></security> </binding> </netMsmqBinding>
and this is the method to the WCF service:
<OperationBehavior(TransactionScopeRequired:=True, TransactionAutoComplete:=True)> _ Public Sub FfmpegConversion(ffmpegjob As FfmpegJob) Implements IOrderService.FfmpegConversion Using sc As New TransactionScope(TransactionScopeOption.Required) Try ExecuteLongProcess() Catch ex As Exception Console.WriteLine(ex.Message) Finally sc.Complete() End Try End Using End Sub
UPDATE
After much testing and research, I begin to think that it is impossible to make a long process in a method that is fired using the MSMQ queeue.
I get around this with another thread that manages the data, but now the problem is that I am losing the TransactionScope vantage, because as soon as the job moves to a new thread, MSMQ removes the msg, as it is believed that this was done.
source share