我同意科迪所说的90%。在某些情况下,类似于pluggin示例,您可能想捕获系统异常。这是考虑使用WCF Web服务的另一个示例。目标:即使遇到错误,也要使用服务并进行处理。让错误冒泡。public static bool DoRemoteWebServiceWork(){ bool result; RemoteWebServiceClient client = new RemoteWebServiceClient(); try { result = client.DoWork(); client.Close(); } catch (Exception) { client.Abort(); //dispose throw;//This service is critical to application function. The application should break if an exception is thrown. //could log end point and binding exceptions to avoid ignoring changes to the remote service that require updates to our code. } return result;}目标:即使遇到错误,也要使用服务并进行处理。防止错误冒泡。public static bool DoRemoteWebServiceWork(){ bool result; RemoteWebServiceClient client = new RemoteWebServiceClient(); try { result = client.DoWork(); client.Close(); } catch (Exception) { client.Abort(); //dispose //throw; //This service is auxiliary to the applications primary function. We have no influence over the service and therefore cannot fix it. //could log end point and binding exceptions to avoid ignoring changes to the remote service that require updates to our code. } return result;}