0

Are services are working, but when the Database goes down, the application pool ends up stopping.

On the service side, we have try/catch with Fault Execeptions for all code connecting to the databases.

I'm looking for an tips on how to reduce these type of errors from the control of the services, as we do not have control over the servers.

Please let me know if more details are needed, and I'll update the posting.

Custom Client-Side Provider:

   public class ClientWCFProvider<TT> : IDisposable
    {

            private ChannelFactory<TT> channel;

            public TT WCF { get; set; }

            public ClientWCFProvider(string service)
            {
                channel = GetServiceChannel(service);
                WCF = channel.CreateChannel();
            }

            private ChannelFactory<TT> GetServiceChannel(string service)
            {
                 BasicHttpBinding serviceBinding = new BasicHttpBinding();
                //set the config on the bindings for timeouts etc.
                serviceBinding.MaxReceivedMessageSize = 105190152; 
                serviceBinding.MaxBufferSize = Convert.ToInt32(serviceBinding.MaxReceivedMessageSize);
                serviceBinding.OpenTimeout = new TimeSpan(0, 3, 0);
                serviceBinding.SendTimeout = new TimeSpan(0, 3, 0);


                EnvironmentDescriptor serviceEnvironment;
                EndpointAddress ServiceEndpoint;

                ... code to setup the endpoint


                ServiceChannel = new ChannelFactory<TT>(serviceBinding, ServiceEndpoint);

                return ServiceChannel;
    }
    public void Dispose()
        {
            ((IClientChannel)WCF).Close();
            channel.Close();
        }
}

Then the services are called like this:

using(var x = new ClientWCFProvider<TT>("NameOfService"))
{
...
}
Omnia9
  • 1,563
  • 4
  • 14
  • 39
  • 2
    I'm missing the question. "tips on how to reduce this from my side". What's "this"? Also calling Close() this way is dangerous. Read this post http://stackoverflow.com/questions/573872/what-is-the-best-workaround-for-the-wcf-client-using-block-issue – ErnieL Nov 08 '11 at 15:40
  • I fixed the question. I'm just looking for more ways to control errors from areas that I can control. Not having access to the servers means that debugging etc is harder. – Omnia9 Nov 08 '11 at 15:52
  • You are writing client code and you would like to know how to reduce the number of errors a service is returning when the DB goes down... but you don't control the service? – ErnieL Nov 08 '11 at 16:27
  • "we do not have control over the servers." We are not able to run tracing and other items on the servers. And we don't have control of the IIS configuration. – Omnia9 Nov 08 '11 at 18:09
  • @ErnieL: we have taken your comments and gone with this:http://blog.davidbarrett.net/archive/2007/11.aspx – Omnia9 Nov 08 '11 at 18:10

1 Answers1

1

The end solution, based on ErnieL is this: http://blog.davidbarrett.net/archive/2007/11.aspx

Omnia9
  • 1,563
  • 4
  • 14
  • 39