none
WCF services using net.tcp stops responding RRS feed

  • Question

  • Hi,

    I have following configuration:

    WCF services are self hosted Windows Service on Windows Server 2008. 
    Net.tcp binding is used as binding mode. 
    we are using .NET Framework 4.5.2 64bit.
    In production there are about 7/10 users working with local client application (WinForms) which connects to the fore-mentioned WCF services.


    This can work fine for days or weeks, but occasionally WCF services stop responding and our WinForms clients become unresponsive. 
    There isn't any error logged in the event viewer on the server. 
    This issue happening with 7/10 users, which doesn't generate heavy load on the server.


    When we restart the WCF services - the application become start working again, but restarting WCF services impacting production hours.

    Please help...This is very critical...Any ideas why this happens are very welcome.

    Thanks in advance!
    • Edited by Suparpal Wednesday, December 21, 2016 12:55 PM
    Wednesday, December 21, 2016 12:28 PM

All replies

  • Hi Suparpal,

    What do you mean by event viewer? I suggest you configure Tracing to capture exceptions in service side.

    Is this issue related with a specific method? Did you process long time method in service side?

    It would be helpful if you could share us more information about your service and client.

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, December 22, 2016 7:31 AM
  • Hi Edward,

    Thank you for your reply.

    Reply on your question, I believe this issue is not related to a specific method, as occurrence of the issue is weekly/ fortnightly and we are not processing any long time method in service side.  

    We can enable WCF tracing on the server side once we have the approval and we are trying to get it soon. Meanwhile we were analyzing Windows Event log and our application log, but unfortunately we are unable to find any relevant expectations when WinForms clients becoming unresponsive. 

    This issue is occurring in the production environment occasionally, sometimes weekly or sometimes fortnightly.  

    One more observation, in our development environment “Net.Tcp Listener Adapter” and “Net.Tcp Port Sharing Service” both the services are enable and running, but these two services are down and disabled in Production. Is that can make any impact?

    I found a blog (https://forums.iis.net/t/1167668.aspx), the same issue was reported here on .NET Framework 3.5 and a hotfix (https://support.microsoft.com/en-us/kb/2504602) was provided by Microsoft. I am using .NET Framework 4.5.2.

    Is the same fix also be part of the Framework 4.5.2 package?


    • Edited by Suparpal Monday, December 26, 2016 11:19 AM
    Monday, December 26, 2016 11:18 AM
  • Hi Suparpal,

    I am not sure whether the KB will work for you. I would confirm below points.

    1. While WCF Service is working in production environment, did the “Net.Tcp Listener Adapter” and “Net.Tcp Port Sharing Service” run?
    2. After WCF Service is down, will it work if you restart there two services?

    I would suggest you enable WCF Tracing first to check the exception message, and I suggest you install this KB to check whether it will work.

    In addition, I suggest you refer below link.

    # WCF netTcpBinding hosted on IIS7.5 Stops Working

    http://stackoverflow.com/questions/6898883/wcf-nettcpbinding-hosted-on-iis7-5-stops-working

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, December 27, 2016 5:52 AM
  • Hi Edward,

    Please find my response on below points -

    1. While WCF Service is working in production environment, did the “Net.Tcp Listener Adapter” and “Net.Tcp Port Sharing Service” run?

    Answer - Not running. “Net.Tcp Listener Adapter” and “Net.Tcp Port Sharing Service” both the services are disabled in Production.

    2. After WCF Service is down, will it work if you restart there two services?

    Answer - As “Net.Tcp Listener Adapter” and “Net.Tcp Port Sharing Service” both the services are disabled, restart scenario never occurred.

    Any ideas if this could be the cause of unresponsive clients?

    Thanks in advance!




    • Edited by Suparpal Thursday, December 29, 2016 9:18 AM
    Thursday, December 29, 2016 9:16 AM
  • Hi Given this is a self-hosted service, there could be additional reasons for failure as opposed to hosting on IIS.

    1. Makre sure the service host fault handler is configured to log errors.

    See example below (sourced from https://www.safaribooksonline.com/library/view/learning-wcf/9780596101626/ch04s05.html)

    public partial class MessagingServiceHost : ServiceBase
    {
      ServiceHost m_serviceHost;
      public MessagingServiceHost( )
      {
        InitializeComponent( );
        this.ServiceName = "MessagingServiceHost";
      }
    
      protected override void OnStart(string[] args)
      {
        m_serviceHost = new ServiceHost(typeof(Messaging.MessagingService));
        m_serviceHost.Open( );
        m_serviceHost.Faulted += new EventHandler(m_serviceHost_Faulted);
    
        string baseAddresses = "";
    
        foreach (Uri address in m_serviceHost.BaseAddresses)
        {
          baseAddresses += " " + address.AbsoluteUri;
        }
        string s = String.Format("{0} listening at {1}", this.ServiceName,
    baseAddresses);
        this.EventLog.WriteEntry(s, EventLogEntryType.Information);
      }
    
      void m_serviceHost_Faulted(object sender, EventArgs e)
      {
        string s = String.Format("{0} has faulted, notify administrators of this
    problem", this.ServiceName);
        this.EventLog.WriteEntry(s, EventLogEntryType.Error);
      }
    
      protected override void OnStop( )
      {
        if (m_serviceHost != null)
        {
          m_serviceHost.Close( );
          string s = String.Format("{0} stopped", this.ServiceName);
          this.EventLog.WriteEntry(s, EventLogEntryType.Information);
        }
    
        m_serviceHost = null;
      }
    }


    2. WCF 3.5 max concurrent sessions is 10 by default http://stackoverflow.com/questions/10614903/servicethrottling-default-values. This could be another setting that effects you. So enable wcf tracing , like Edward has suggested, to check if wcf default settings are throttling calls.

    Thursday, December 29, 2016 12:44 PM