WCF Service dies on its own after some time

前端 未结 1 919
感动是毒
感动是毒 2021-02-20 17:49

I am facing a peculiar problem related to a hosted WCF service (.NET Framework 4, IIS 7, Windows 2008 Standard SP2).

After I deployed the service it works fine for some

相关标签:
1条回答
  • 2021-02-20 18:11

    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. enter image description here

    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);
        }
    
    0 讨论(0)
提交回复
热议问题