• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ServiceModel.FaultReason类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



FaultReason类属于System.ServiceModel命名空间,在下文中一共展示了FaultReason类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Fault

 public Fault(string action, FaultCode code, string reasonText)
 {
     this.action = action;
     this.code = code;
     this.reasonText = reasonText;
     this.reason = new FaultReason(reasonText, CultureInfo.CurrentCulture);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:Fault.cs


示例2: FaultException

 internal FaultException(FaultReason reason, FaultCode code, string action, Exception innerException)
     : base(FaultException.GetSafeReasonText(reason), innerException)
 {
     _code = FaultException.EnsureCode(code);
     _reason = FaultException.EnsureReason(reason);
     _action = action;
 }
开发者ID:SoumikMukherjeeDOTNET,项目名称:wcf,代码行数:7,代码来源:FaultException.cs


示例3: FaultException

 protected FaultException(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     this.code = this.ReconstructFaultCode(info, "code");
     this.reason = this.ReconstructFaultReason(info, "reason");
     this.fault = (MessageFault) info.GetValue("messageFault", typeof(MessageFault));
     this.action = info.GetString("action");
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:FaultException.cs


示例4: WsrmFault

 // remote
 protected WsrmFault(FaultCode code, string subcode, FaultReason reason)
 {
     this.code = code;
     this.subcode = subcode;
     this.reason = reason;
     this.isRemote = true;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:8,代码来源:WsrmFault.cs


示例5: CreateWsrmHeaderFault

 private static WsrmHeaderFault CreateWsrmHeaderFault(ReliableMessagingVersion reliableMessagingVersion, FaultCode code, string subcode, FaultReason reason, XmlDictionaryReader detailReader)
 {
     if (code.IsSenderFault)
     {
         if (subcode == "InvalidAcknowledgement")
         {
             return new InvalidAcknowledgementFault(code, reason, detailReader, reliableMessagingVersion);
         }
         if (subcode == "MessageNumberRollover")
         {
             return new MessageNumberRolloverFault(code, reason, detailReader, reliableMessagingVersion);
         }
         if (subcode == "UnknownSequence")
         {
             return new UnknownSequenceFault(code, reason, detailReader, reliableMessagingVersion);
         }
         if (reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessagingFebruary2005)
         {
             if (subcode == "LastMessageNumberExceeded")
             {
                 return new LastMessageNumberExceededFault(code, reason, detailReader, reliableMessagingVersion);
             }
         }
         else if ((reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11) && (subcode == "SequenceClosed"))
         {
             return new SequenceClosedFault(code, reason, detailReader, reliableMessagingVersion);
         }
     }
     if (!code.IsSenderFault && !code.IsReceiverFault)
     {
         return null;
     }
     return new SequenceTerminatedFault(code, reason, detailReader, reliableMessagingVersion);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:34,代码来源:WsrmHeaderFault.cs


示例6: MakeConnectionMessageFault

 protected MakeConnectionMessageFault(Message message, FaultCode code, string subcode, FaultReason reason)
 {
     this.code = code;
     this.subcode = subcode;
     this.reason = reason;
     this.isRemote = true;
     this.originalMessageId = message.Headers.MessageId;
 }
开发者ID:tian1ll1,项目名称:WPF_Examples,代码行数:8,代码来源:MakeConnectionMessageFault.cs


示例7: WSAddressing10ProblemHeaderQNameFault

 public WSAddressing10ProblemHeaderQNameFault(ActionMismatchAddressingException e)
 {
     this.invalidHeaderName = "Action";
     this.code = FaultCode.CreateSenderFaultCode(new FaultCode("ActionMismatch", AddressingVersion.WSAddressing10.Namespace));
     this.reason = new FaultReason(e.Message, CultureInfo.CurrentCulture);
     this.actor = "";
     this.node = "";
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:WSAddressing10ProblemHeaderQNameFault.cs


示例8: Simple

		public void Simple ()
		{
			FaultReason r = new FaultReason ("testing");
			FaultReasonText t = r.GetMatchingTranslation ();
			Assert.IsNotNull (t);
			Assert.AreEqual ("testing", t.Text, "#1");
			Assert.AreEqual (CultureInfo.CurrentCulture.Name,
				t.XmlLang, "#2");
		}
开发者ID:nickchal,项目名称:pash,代码行数:9,代码来源:FaultReasonTest.cs


示例9: XmlObjectSerializerFault

 public XmlObjectSerializerFault(FaultCode code, FaultReason reason, object detail, XmlObjectSerializer serializer, string actor, string node)
 {
     this.code = code;
     this.reason = reason;
     this.detail = detail;
     this.serializer = serializer;
     this.actor = actor;
     this.node = node;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:XmlObjectSerializerFault.cs


示例10: WSAddressing10ProblemHeaderQNameFault

 public WSAddressing10ProblemHeaderQNameFault(ActionMismatchAddressingException e)
 {
     _invalidHeaderName = AddressingStrings.Action;
     _code = FaultCode.CreateSenderFaultCode(
         new FaultCode(Addressing10Strings.ActionMismatch, AddressingVersion.WSAddressing10.Namespace));
     _reason = new FaultReason(e.Message, CultureInfo.CurrentCulture);
     _actor = "";
     _node = "";
 }
开发者ID:weshaggard,项目名称:wcf,代码行数:9,代码来源:WSAddressing10ProblemHeaderQNameFault.cs


示例11: InvalidAcknowledgementFault

 public InvalidAcknowledgementFault(FaultCode code, FaultReason reason, XmlDictionaryReader detailReader, ReliableMessagingVersion reliableMessagingVersion) : base(code, "InvalidAcknowledgement", reason, true, false)
 {
     UniqueId id;
     bool flag;
     WsrmAcknowledgmentInfo.ReadAck(reliableMessagingVersion, detailReader, out id, out this.ranges, out flag);
     base.SequenceID = id;
     while (detailReader.IsStartElement())
     {
         detailReader.Skip();
     }
     detailReader.ReadEndElement();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:InvalidAcknowledgementFault.cs


示例12: Main

 static void Main(string[] args)
 {
     FaultCode code = FaultCode.CreateSenderFaultCode("calcuError", "http://www.artech.com");
     FaultReasonText reasonText1 = new FaultReasonText("Divided by zero!", "en-US");
     FaultReasonText reasonText2 = new FaultReasonText("试图除以零!", "zh-CN");
     FaultReason reason = new FaultReason(new FaultReasonText[] { reasonText1, reasonText2 });
     MessageFault fault = MessageFault.CreateFault(code, reason);
     string action = "http://www.artech.com/divideFault";
     using (Message message = Message.CreateMessage(MessageVersion.Default, fault, action))
     {
         WriteMessage(message, "message.xml");
     }
 }
开发者ID:huoxudong125,项目名称:WCF-Demo,代码行数:13,代码来源:Program.cs


示例13: ThrowGenericFaultException

        public void ThrowGenericFaultException()
        {
            var details = new ErrorDetails
            {
                Code = 666,
                Name = "Devil",
                Description = "This is the end!"
            };

            var reason = new FaultReason("This is the FulaReason");
            var code = FaultCode.CreateReceiverFaultCode("ThrowGenericFaultException", "Server.Service");

            throw new FaultException<ErrorDetails>(details, reason, code);
        }
开发者ID:iivchenko,项目名称:Learning-WCF,代码行数:14,代码来源:Service.cs


示例14: ProvideFault

 internal Message ProvideFault(MessageVersion messageVersion)
 {
     string name = _notUnderstoodHeaders[0].Name;
     string ns = _notUnderstoodHeaders[0].Namespace;
     FaultCode code = new FaultCode(MessageStrings.MustUnderstandFault, _envelopeVersion.Namespace);
     FaultReason reason = new FaultReason(SR.Format(SR.SFxHeaderNotUnderstood, name, ns), CultureInfo.CurrentCulture);
     MessageFault fault = MessageFault.CreateFault(code, reason);
     string faultAction = messageVersion.Addressing.DefaultFaultAction;
     Message message = System.ServiceModel.Channels.Message.CreateMessage(messageVersion, fault, faultAction);
     if (_envelopeVersion == EnvelopeVersion.Soap12)
     {
         this.AddNotUnderstoodHeaders(message.Headers);
     }
     return message;
 }
开发者ID:SoumikMukherjeeDOTNET,项目名称:wcf,代码行数:15,代码来源:MustUnderstandSoapException.cs


示例15: CreateFault

        /// <summary>
        /// Creates a new FaultException with our fault details based on an existing exception.
        /// </summary>
        /// <param name="exception">The exception to wrap.</param>
        /// <returns></returns>
        public static FaultException<AlarmWorkflowFaultDetails> CreateFault(Exception exception)
        {
            Assertions.AssertNotNull(exception, "exception");

            if (exception is FaultException<AlarmWorkflowFaultDetails>)
            {
                return (FaultException<AlarmWorkflowFaultDetails>)exception;
            }

            FaultReason reason = new FaultReason(exception.Message);
            FaultCode code = new FaultCode("(No code)");
            AlarmWorkflowFaultDetails detail = new AlarmWorkflowFaultDetails(exception);

            return new FaultException<AlarmWorkflowFaultDetails>(detail, reason, code);
        }
开发者ID:happy5217744,项目名称:AlarmWorkflow,代码行数:20,代码来源:AlarmWorkflowFaultDetails.cs


示例16: ProvideFault

 internal Message ProvideFault(MessageVersion messageVersion)
 {
     string name = this.notUnderstoodHeaders[0].Name;
     string str2 = this.notUnderstoodHeaders[0].Namespace;
     FaultCode code = new FaultCode("MustUnderstand", this.envelopeVersion.Namespace);
     FaultReason reason = new FaultReason(System.ServiceModel.SR.GetString("SFxHeaderNotUnderstood", new object[] { name, str2 }), CultureInfo.CurrentCulture);
     MessageFault fault = MessageFault.CreateFault(code, reason);
     string defaultFaultAction = messageVersion.Addressing.DefaultFaultAction;
     Message message = Message.CreateMessage(messageVersion, fault, defaultFaultAction);
     if (this.envelopeVersion == System.ServiceModel.EnvelopeVersion.Soap12)
     {
         this.AddNotUnderstoodHeaders(message.Headers);
     }
     return message;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:15,代码来源:MustUnderstandSoapException.cs


示例17: WsrmFault

 protected WsrmFault(bool isSenderFault, string subcode, string faultReason, string exceptionMessage)
 {
     if (isSenderFault)
     {
         this.code = new FaultCode("Sender", "");
     }
     else
     {
         this.code = new FaultCode("Receiver", "");
     }
     this.subcode = subcode;
     this.reason = new FaultReason(faultReason, CultureInfo.CurrentCulture);
     this.exceptionMessage = exceptionMessage;
     this.isRemote = false;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:15,代码来源:WsrmFault.cs


示例18: ProvideFault

        public void ProvideFault(Exception error, MessageVersion version, ref Message fault)
        {
            if (error is FaultException)
                return;
            ServiceOperationFault serviceOperationFault = new ServiceOperationFault();
            FaultReason fr = new FaultReason(error.ToString());
            FaultCode fc = new FaultCode("0001");
            // Creates the exception we want to send back to the client
            var exception = new FaultException<ServiceOperationFault>(serviceOperationFault, fr);

            // Creates a message fault
            var messageFault = exception.CreateMessageFault();

            // Creates the new message based on the message fault
            fault = Message.CreateMessage(version, messageFault, exception.Action);
        }
开发者ID:etrotmanPictureU,项目名称:PivotService,代码行数:16,代码来源:GlobalErrorServiceBehavior.cs


示例19: CreateFault

 internal static Exception CreateFault(string reasonText, string codeString, bool isNetDispatcherFault)
 {
     string str;
     string str2;
     if (isNetDispatcherFault)
     {
         str = "http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher";
         str2 = "http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher/fault";
     }
     else
     {
         str = "http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/transactions";
         str2 = "http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/transactions/fault";
     }
     FaultReason reason = new FaultReason(reasonText, CultureInfo.CurrentCulture);
     return new FaultException(reason, FaultCode.CreateSenderFaultCode(codeString, str), str2);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:17,代码来源:TransactionBehavior.cs


示例20: FaultReason

        void IErrorHandler.ProvideFault(Exception error, MessageVersion version, ref Message fault)
        {
            try
            {
                // Add code here to build faultreason for client based on exception
                FaultReason faultReason = new FaultReason(error.Message);
                ExceptionDetail exceptionDetail = new ExceptionDetail(error);

                // For security reasons you can also decide to not give the ExceptionDetail back to the client or change the message, etc
                FaultException<ExceptionDetail> faultException = new FaultException<ExceptionDetail>(exceptionDetail, faultReason, FaultCode.CreateSenderFaultCode(new FaultCode("0")));

                MessageFault messageFault = faultException.CreateMessageFault();
                fault = Message.CreateMessage(version, messageFault, faultException.Action);
            }
            catch
            {
                // Todo log error
            }
        }
开发者ID:thshr,项目名称:SL-movdb,代码行数:19,代码来源:WcfExceptionHandling.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ServiceModel.InstanceContext类代码示例发布时间:2022-05-26
下一篇:
C# ServiceModel.FaultException类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap