Locked WCF service failure

  • 2008年9月30日 7:12
     
     

     

    Hi,

    I have windows application with WCF service. On form load, there are some methods to load master table values , and i have an method to get some data based on month. I have 3 calls made to WCF service to fetch information and display on form load. Most of the times, the application hangs and I get a message 'Unable to process request'  with a 'Catastrophic failure' message. And any frequent calls to poll DB through the WCF service hangs the application.

     

    Can anyone help me in resolving the problem for catastrophic failure.

     

    Thanks,

    Sangeetha

すべての返信

  • 2008年9月30日 8:18
     
     
  • 2009年11月11日 7:34
     
     回答の候補
    Hi,

    You can resolve this issue by using "using" statement.
    Because ones you called service, it will not close automatically and request will reach at its maximum limit. So you have to close after use ones.

    using(serviceClient srvClient = new serviceClient)
    {
        //code here
    }

    //This service will be freed connection after.
    • 回答の候補に設定 spguy2012 2011年3月9日 13:17
    •  
  • 2010年6月25日 14:33
     
     

    This can be solved by creating singleton class as interface between web service reference and application.  Then it will create only one instance of service reference.

    class ServiceInterface

    {

         private static ServiceInterface  _instance;

         private ServiceClient _service = new ServiceClient ;

     

        private ServiceInterface()

      {

           //Prevent accessing default constructor

      }

      public static ServiceInterface GetInstance()

     {

         if(_instance == null)

         {

          _instance = new ServiceInterface();

        }

            return _instance;

     

     }

       // You can add your functions to access web service here


    }

  • 2011年3月9日 13:17
     
     
    thanks dude Your answer is great
    Like Cricket
  • 2011年9月23日 14:59
     
     
    Hi,

    You can resolve this issue by using "using" statement.
    Because ones you called service, it will not close automatically and request will reach at its maximum limit. So you have to close after use ones.

    using(serviceClient srvClient = new serviceClient)
    {
        //code here
    }

    //This service will be freed connection after.
    Thanks.
    White Carpet Kitchen Carpet