Workflow Foundation (WF4) с MsmqIntegrationBinding - сбойный WorkflowServiceHost

У меня есть рабочий процесс, который начинается с получения активности. Я принимаю WF так:

static void Main(string[] args)
    {  
        string queueName = @ConfigurationManager.AppSettings["ServiceQueue"];
        if (!MessageQueue.Exists(queueName))
        {
            MessageQueue.Create(queueName, true);
            Console.WriteLine("Message Queue {0} created", queueName);
            Console.WriteLine("Press <enter> to exit");
            Console.ReadLine();
            return;
        }

        WorkflowServiceHost host = PruebasAdslServiceHost.CreateWorkflowServiceHost();
        host.Open();

        Console.ReadLine();

        host.Close();
    }

Нет проблем с открытием хоста, но когда я помещаю сообщение в очередь, в рабочем процессе появляется какая-то ошибка, которая входит в состояние ошибки. Я думаю, что-то не так в Recive Activity или что-то в этом роде. Я положил здесь код де WF:

public static class PruebasAdslServiceHost
{
    public static WorkflowServiceHost CreateWorkflowServiceHost()
    {

        WorkflowService service = new WorkflowService()
        {
            Body = PruebasAdslSequences.CreateBody(),

            Endpoints =
            {

                new System.ServiceModel.Endpoint
                {  
                    Binding = new System.ServiceModel.MsmqIntegration.MsmqIntegrationBinding(MsmqIntegrationSecurityMode.None),//("MsmqIntegrationBindingsTx"),
                    AddressUri = new Uri(ConfigurationManager.AppSettings["ServiceHostQueue"]),
                    ServiceContractName = XName.Get(PruebasAdslSequences.poContractDescription.Name)
                }
            }
        };
        WorkflowServiceHost workflowServiceHost = new WorkflowServiceHost(service);


        // agregamos behaviors

       /* IServiceBehavior idleBehavior = new WorkflowIdleBehavior { TimeToUnload = TimeSpan.Zero };
        workflowServiceHost.Description.Behaviors.Add(idleBehavior);*/

        IServiceBehavior workflowUnhandledExceptionBehavior = new WorkflowUnhandledExceptionBehavior()
        {
            Action = WorkflowUnhandledExceptionAction.AbandonAndSuspend // this is also the default
        };
        workflowServiceHost.Description.Behaviors.Add(workflowUnhandledExceptionBehavior);


        // agregamos constr para el manejo de las instancias en base 
        SqlWorkflowInstanceStoreBehavior instanceStoreBehavior = new SqlWorkflowInstanceStoreBehavior()
        {
            ConnectionString = ConfigurationManager.ConnectionStrings["ServiceProcessSampleStore"].ToString()
        };
        workflowServiceHost.Description.Behaviors.Add(instanceStoreBehavior);

        //Agregamos que el wf se baje por el delay del proceso asi no queda en memoria esperando
        WorkflowIdleBehavior workflowIdleBehavior = new WorkflowIdleBehavior()
        {
            TimeToUnload = TimeSpan.FromSeconds(0)
        };
        workflowServiceHost.Description.Behaviors.Add(workflowIdleBehavior);

        // agregamos un endpoint mas por net pipe para tener un endpoind administrado
        ServiceEndpoint workflowControlEndpoint = new WorkflowControlEndpoint()
        {
            Binding = new System.ServiceModel.NetNamedPipeBinding(System.ServiceModel.NetNamedPipeSecurityMode.None),
            Address = new System.ServiceModel.EndpointAddress("net.pipe://workflowInstanceControl")
        };
        workflowServiceHost.AddServiceEndpoint(workflowControlEndpoint);


        // agregamos el servicio de traking para ver los estados de las activiadades
        workflowServiceHost.WorkflowExtensions.Add(new TrackingListenerConsole());


        foreach (ServiceEndpoint ep in workflowServiceHost.Description.Endpoints)
        {
            Console.WriteLine(ep.Address);
        }

        return workflowServiceHost;
    }
}

И Тело Последовательности здесь:

public class PruebasAdslSequences
{
    public static ContractDescription poContractDescription = ContractDescription.GetContract(typeof(IPruebasAdsl));


    public static Activity CreateBody()
    {
        Variable<PruebasAdslReq> pruebaAdsl = new Variable<PruebasAdslReq> { Name = "message" };
        Variable<MsmqMessage<PruebasAdslReq>> pruebaAdslQueue = new Variable<MsmqMessage<PruebasAdslReq>> { Name = "queue" };

        Sequence sequence = new Sequence
        {
            Variables = 
            {
                pruebaAdsl,
                pruebaAdslQueue
            },

            Activities =
            {

                new Receive
                {
                    OperationName = "EjecutarPruebasADSL",
                    ServiceContractName = XName.Get(poContractDescription.Name),
                    CanCreateInstance = true,
                    Content = new ReceiveMessageContent
                    {
                        Message = new OutArgument<MsmqMessage<PruebasAdslReq>>(pruebaAdslQueue),
                        DeclaredMessageType = typeof(MsmqMessage<PruebasAdslReq>)

                    }


                },

                new PruebasAdslActivitys
                {
                    RequestPruebas = new InArgument<PruebasAdslReq> (x=> pruebaAdslQueue.Get(x).Body)
                },



            }
        };

        return sequence;
    }
}

Есть идеи об этой проблеме? До этого я использовал wf с NetMsmqBinding, и он работает правильно.

Спасибо

0 ответов