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"))
{
...
}
The end solution, based on ErnieL is this: http://blog.davidbarrett.net/archive/2007/11.aspx