コード例 #1
0
    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();
        }
    }
コード例 #2
0
 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();
     }
 }
コード例 #3
0
ファイル: Hello.aspx.cs プロジェクト: hijushen/WindowDemo
 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();
     }
 }
コード例 #4
0
 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();
     }
 }
コード例 #5
0
ファイル: Hello.aspx.cs プロジェクト: hijushen/WindowDemo
 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();
     }
 }
コード例 #6
0
 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;
         }
     }
 }
コード例 #7
0
ファイル: Hello.aspx.cs プロジェクト: hijushen/WindowDemo
 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;
         }
     }
 }
コード例 #8
0
ファイル: Hello.aspx.cs プロジェクト: hijushen/WindowDemo
    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();
        }
    }