|
I'm trying to check to see if a WCF service is running, and if not, exit. So far I have this:
bool serviceRunning = true;
try
{
Proxy = new MyAppServiceRef.MyAppServiceClient();
}
catch (Exception e)
{
serviceRunning = false;
}
try
{
serviceRunning = !Proxy.ServiceRunning();
}
catch (Exception e)
{
serviceRunning = false;
}
if (!serviceRunning)
{
string message = "The service appears to not be running. Please check the service. " + ApplicationTitle + " will now exit.";
MessageBox.Show(message, "Service Error", MessageBoxButton.OK, MessageBoxImage.Stop);
Application.Current.Shutdown();
}
1) is this really the way to do this?
2) After the call to Application.Current.Shutdown() the app continue to run and I get XAML errors. How to I actually stop the app dead right here?
Thanks
If it's not broken, fix it until it is
|
|
|
|