WCF Service dies on its own after some time

こ雲淡風輕ζ 提交于 2019-12-04 01:54:45

Is it possible the file not found is a red herring and you are just experiencing an inactivity timeout? I remember when I wrote my first WCF service I didn't realize the timeout settings defaulted to something fairly short like a couple of minutes. I think you can set them to be very long (like 24 days).

In my app config in the <configuration> section immediately after my <system.web> section I have:

    <system.serviceModel>
    <bindings>
        <netTcpBinding>
            <binding name="tcp_unsecured" receiveTimeout="infinite" sendTimeout="00:00:30">
                <security mode="None">
                </security>
            </binding>
        </netTcpBinding>
    </bindings>

This is followed by my service and behaviors sections. Here's a png of the dialog when I right click and select Edit WCF Configuration on my app.config. I typed "infinite in the app.config xml file but the dialog turns that into the relevant large value.

Update: In my mediator class here is the constructor that sets up a NetTcpBinding. I'm including this because it appears I needed to set the timeouts in code.

    public DspServiceMediator( String serviceAddress)
    {
        EndpointAddress end_point = new EndpointAddress(serviceAddress);
        NetTcpBinding new_tcp = new NetTcpBinding(SecurityMode.None)
                                {ReceiveTimeout = TimeSpan.MaxValue,
                                 SendTimeout = new TimeSpan(0, 0, 30)
                                };

        _dspClient = new DspServiceClient(new_tcp, end_point);
    }
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!