当前位置: 首页>>代码示例>>C#>>正文


C# FaultException.ToString方法代码示例

本文整理汇总了C#中System.ServiceModel.FaultException.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# FaultException.ToString方法的具体用法?C# FaultException.ToString怎么用?C# FaultException.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.ServiceModel.FaultException的用法示例。


在下文中一共展示了FaultException.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FinishWithFaultException

 /// <summary>
 /// Handles fault exception during publishing
 /// </summary>
 /// <param name="CustomFaultException"></param>
 private void FinishWithFaultException(FaultException fe)
 {
     boolError = true;
     string statusMessage = "Fault Exception";
     AddStatusMessage(statusMessage);
     btnShowLog.Enabled = true;
     txtStatusSummary.Text = statusMessage;
     txtStatus.AppendText(fe.ToString());
     btnDetails.Visible = true;
     this.progressBar.Visible = false;
     this.Cursor = Cursors.Default;
     panel2.Visible = false;
     lblSuccessNotice.Text = "Fault Exception";
     lblSuccessNotice.BackColor = Color.FromArgb(243, 217, 217);
     panel3.Visible = true;
     lblSuccessNotice2.Visible = false;
 }
开发者ID:NALSS,项目名称:epiinfo-82474,代码行数:21,代码来源:WebPublishDialog.cs

示例2: GetPSClientError

        /// <summary>
        /// Extract a PSClientError object from the ServiceModel.FaultException,
        /// for use in output of the GetPSClientError stack of errors.
        /// </summary>
        /// <param name="e"></param>
        /// <param name="errOut">Shows that FaultException has more information 
        /// about the errors than PSClientError has. FaultException can also contain 
        /// other types of errors, such as failure to connect to the server.</param>
        /// <returns>PSClientError object, for enumerating errors.</returns>
        public static PSLibrary.PSClientError GetPSClientError(FaultException e, 
                                                               out string errOut)
        {
            const string PREFIX = "GetPSClientError() returns null: ";
            errOut = string.Empty;
            PSLibrary.PSClientError psClientError = null;

            if (e == null)
            {
                errOut = PREFIX + "Null parameter (FaultException e) passed in.";
                psClientError = null;
            }
            else
            {
                // Get a ServiceModel.MessageFault object.
                var messageFault = e.CreateMessageFault();

                if (messageFault.HasDetail)
                {
                    using (var xmlReader = messageFault.GetReaderAtDetailContents())
                    {
                        var xml = new XmlDocument();
                        xml.Load(xmlReader);

                        var serverExecutionFault = xml["ServerExecutionFault"];
                        if (serverExecutionFault != null)
                        {
                            var exceptionDetails = serverExecutionFault["ExceptionDetails"];
                            if (exceptionDetails != null)
                            {
                                try
                                {
                                    errOut = exceptionDetails.InnerXml + "\r\n";
                                    psClientError =
                                        new PSLibrary.PSClientError(exceptionDetails.InnerXml);
                                }
                                catch (InvalidOperationException ex)
                                {
                                    errOut = PREFIX + "Unable to convert fault exception info ";
                                    errOut += "a valid Project Server error message. Message: \n\t";
                                    errOut += ex.Message;
                                    psClientError = null;
                                }
                            }
                            else
                            {
                                errOut = PREFIX + "The FaultException e is a ServerExecutionFault, "
                                    + "but does not have ExceptionDetails.";
                            }
                        }
                        else
                        {
                            errOut = PREFIX + "The FaultException e is not a ServerExecutionFault.";
                        }
                    }
                }
                else // No detail in the MessageFault.
                {
                    errOut = PREFIX + "The FaultException e does not have any detail.";
                }
            }
            errOut += "\r\n" + e.ToString() + "\r\n";
            return psClientError;
        }
开发者ID:jgoodso2,项目名称:PMIS,代码行数:73,代码来源:Helpers.cs

示例3: TestToString

		public void TestToString ()
		{
			FaultException<int> e = new FaultException<int> (0);			
			Assert.AreEqual (
				String.Format ("{0}: {1} (Fault Detail is equal to {2}).", e.GetType (), e.Message, e.Detail),
				e.ToString ());
		}
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:FaultExceptionTest.cs


注:本文中的System.ServiceModel.FaultException.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。