开发者

wcf netmsmq transactional service

Hy, all.

I have an interesting case. I have tried to create a wcf service-client communication based on netmsmq binding hosted on windows service app. So I catch a problem with my host service - it can not receive any message from queue. MSDTC shows transaction rollback. And after some tries messages are moving into retry subqueue. ServiceHost become failed state and after i start in again in fails again and again. So in host application i开发者_开发技巧 have no exception and nothing except host fault state. I have service with two contracts (if it is important).

[ServiceContract]
public interface IService
{
    [OperationContract(IsOneWay = true)]
    void Send1(MyDataContract data);

    [OperationContract(IsOneWay = true)]
    void Send2(MyDataContract data);
}
[DataContract]
public class MyDataContract
{
    [DataMember]
    public string From { get; set; }
    [DataMember]
    public string Host { get; set; }
    [DataMember]
    public string To { get; set; }
    [DataMember]
    public DateTime SendTime { get; set; }
}

some service implementation

[OperationBehavior(TransactionScopeRequired = true, 
                 TransactionAutoComplete = true)]
public void Send1(MyDataContract dc)
{......}

service config:

<endpoint address="net.msmq://localhost/private/myservice" binding="netMsmqBinding" contract="IService" bindingConfiguration="NetMsmqBinding_IService" />

Messages are in queue - client service works fine. So at runtime method Send1 of service host never executes. But i handle HostFaulted events close after moving message from retry subqueue to incoming queue. That's all i can say.

any help?


So, i spend around one day to detect the problem. So step by step: 1. I've got microsoft sample on msmq wcf 2. I found no difference 3. I understood, that i have big messages (larger 1Mb), so by default WCF can, not deserialize such big messages. It was neccessary to set maxBufferPoolSize and maxReceivedMessageSize

But that's the question - why wcf client successfuly send such big messages without any extended configurations :)

My advise: in WCF set package size and pools to max possible for you (if only you uses that service).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜