protected void btnHelloIErrorHandler_Click(object sender, EventArgs e) { ExceptionService.HelloClient proxy = new ExceptionService.HelloClient(); try { proxy.HelloIErrorHandler(); } catch (Exception ex) { System.ServiceModel.FaultException faultException = ex as System.ServiceModel.FaultException; if (faultException != null) { lblMsg.Text = string.Format("错误信息:{0}", faultException.Message); } else { lblMsg.Text = ex.ToString(); } } finally { proxy.Close(); } }
protected void btnHelloFaultException_Click(object sender, EventArgs e) { ExceptionService.HelloClient proxy = new ExceptionService.HelloClient(); try { proxy.HelloFaultException(); } catch (FaultException ex) { lblMsg.Text = string.Format("错误编码:{0};错误原因:{1}", ex.Code.Name, ex.Reason.ToString()); } finally { proxy.Close(); } }
protected void btnHelloFaultException_Click(object sender, EventArgs e) { ExceptionService.HelloClient proxy = new ExceptionService.HelloClient(); try { proxy.HelloFaultException(); } catch (FaultException ex) { lblMsg.Text = string.Format("错误编码:{0};错误原因:{1}", ex.Code.Name, ex.Reason.ToString()); } finally { proxy.Close(); } }
protected void btnHelloFaultExceptionGeneric_Click(object sender, EventArgs e) { ExceptionService.HelloClient proxy = new ExceptionService.HelloClient(); try { proxy.HelloFaultExceptionGeneric(); } catch (System.ServiceModel.FaultException<ExceptionService.FaultMessage> ex) { lblMsg.Text = string.Format("错误代码:{0};错误信息:{1};错误原因:{2}", ex.Detail.ErrorCode.ToString(), ex.Detail.Message, ex.Reason.ToString()); } finally { proxy.Close(); } }
protected void btnHelloFaultExceptionGeneric_Click(object sender, EventArgs e) { ExceptionService.HelloClient proxy = new ExceptionService.HelloClient(); try { proxy.HelloFaultExceptionGeneric(); } catch (System.ServiceModel.FaultException<ExceptionService.FaultMessage> ex) { lblMsg.Text = string.Format("错误代码:{0};错误信息:{1};错误原因:{2}", ex.Detail.ErrorCode.ToString(), ex.Detail.Message, ex.Reason.ToString()); } finally { proxy.Close(); } }
protected void btnHelloException_Click(object sender, EventArgs e) { ExceptionService.HelloClient proxy = new ExceptionService.HelloClient(); try { proxy.HelloException(); } catch (Exception ex) { lblMsg.Text = ex.Message; } finally { try { proxy.Close(); } catch (Exception ex) { lblMsg.Text += "<br />" + ex.Message; } } }
protected void btnHelloException_Click(object sender, EventArgs e) { ExceptionService.HelloClient proxy = new ExceptionService.HelloClient(); try { proxy.HelloException(); } catch (Exception ex) { lblMsg.Text = ex.Message; } finally { try { proxy.Close(); } catch (Exception ex) { lblMsg.Text += "<br />" + ex.Message; } } }
protected void btnHelloIErrorHandler_Click(object sender, EventArgs e) { ExceptionService.HelloClient proxy = new ExceptionService.HelloClient(); try { proxy.HelloIErrorHandler(); } catch (Exception ex) { System.ServiceModel.FaultException faultException = ex as System.ServiceModel.FaultException; if (faultException != null) { lblMsg.Text = string.Format("错误信息:{0}", faultException.Message); } else { lblMsg.Text = ex.ToString(); } } finally { proxy.Close(); } }