WCF Error Handling
https://docs.microsoft.com/en-us/dotnet/framework/wcf/wcf-error-handling
The errors encountered by a WCF application belong to one of three groups:
Communication Errors
Proxy/Channel Errors
Application Errors
Communication errors occur when a network is unavailable, a client uses an incorrect address, or the service host is not listening for incoming messages. Errors of this type are returned to the client as CommunicationException or CommunicationException-derived classes.
Proxy/Channel errors are errors that occur within the channel or proxy itself. Errors of this type include: attempting to use a proxy or channel that has been closed, a contract mismatch exists between the client and service, or the client’s credentials are rejected by the service. There are many different types of errors in this category, too many to list here. Errors of this type are returned to the client as-is (no transformation is performed on the exception objects).
Application errors occur during the execution of a service operation. Errors of this kind are sent to the client as FaultException or FaultException<TDetail>.
Error handling in WCF is performed by one or more of the following:
Directly handling the exception thrown. This is only done for communication and proxy/channel errors.
Using fault contracts
Implementing the IErrorHandler interface
Handling ServiceHost events
Fault Contracts
Fault contracts allow you to define the errors that can occur during service operation in a platform independent way. By default all exceptions thrown from within a service operation will be returned to the client as a FaultException object. The FaultException object will contain very little information. You can control the information sent to the client by defining a fault contract and returning the error as a FaultException<TDetail>. For more information, see Specifying and Handling Faults in Contracts and Services.
IErrorHandler
The IErrorHandler interface allows you more control over how your WCF application responds to errors. It gives you full control over the fault message that is returned to the client and allows you to perform custom error processing such as logging. For more information about IErrorHandler and Extending Control Over Error Handling and Reporting
ServiceHost Events
The ServiceHost class hosts services and defines several events that may be needed for handling errors. For example:
For more information, see ServiceHost
WCF Error Handling的更多相关文章
- Erlang error handling
Erlang error handling Contents Preface try-catch Process link Erlang-way error handling OTP supervis ...
- MySQL Error Handling in Stored Procedures 2
Summary: this tutorial shows you how to use MySQL handler to handle exceptions or errors encountered ...
- setjmp()、longjmp() Linux Exception Handling/Error Handling、no-local goto
目录 . 应用场景 . Use Case Code Analysis . 和setjmp.longjmp有关的glibc and eglibc 2.5, 2.7, 2.13 - Buffer Over ...
- Error Handling
Use Exceptions Rather Than Return Codes Back in the distant past there were many languages that didn ...
- Error Handling and Exception
The default error handling in PHP is very simple.An error message with filename, line number and a m ...
- Clean Code–Chapter 7 Error Handling
Error handling is important, but if it obscures logic, it's wrong. Use Exceptions Rather Than Return ...
- [RxJS] Error handling operator: catch
Most of the common RxJS operators are about transformation, combination or filtering, but this lesso ...
- MySQL Error Handling in Stored Procedures---转载
This tutorial shows you how to use MySQL handler to handle exceptions or errors encountered in store ...
- Error Handling in ASP.NET Core
Error Handling in ASP.NET Core 前言 在程序中,经常需要处理比如 404,500 ,502等错误,如果直接返回错误的调用堆栈的具体信息,显然大部分的用户看到是一脸懵逼的 ...
随机推荐
- 第一个spring boot应用
前提 首先要确保已经安装了java和maven: $ java -version java version "1.8.0_102" Java(TM) SE Runtime Envi ...
- SpringBoot jar程序配置成服务运行
windows 版本 http://www.cppblog.com/aurain/archive/2014/01/23/205534.aspx linux 版本 https://blog.csdn.n ...
- Nacos1.1.3小试牛刀
什么是 Nacos(摘自https://nacos.io/zh-cn/docs/quick-start.html) Nacos 致力于帮助您发现.配置和管理微服务.Nacos 提供了一组简单易用的特性 ...
- HDFS中NameNode和Secondary NameNode工作机制
NameNode工作机制 0)启动概述 Namenode启动时,首先将映像文件(fsimage)载入内存,并执行编辑日志(edits)中的各项操作.一旦在内存中成功建立文件系统元数据的映像,则创建一个 ...
- TFS版本对应
原文: MSDN Operating systems TFS can be installed on a Windows server or client operating system. TFS ...
- day16 django 笔记
一 jQuery是什么? [1] jQuery由美国人John Resig创建,至今已吸引了来自世界各地的众多 javascript高手加入其team. [2] jQuery是继prototy ...
- Ftp客户端(上传文件)
#coding=utf-8 import os import socket import hashlib import json # client = socket.socket() #申明socke ...
- JavaScript、ES6中的类和对象
面向对象可以用于描述现实世界的事物,但是事物分为具体的(特指的)事物和抽象的(泛指的)事物. 面向对象思维的特点: 1.抽取(抽象)对象共有的属性和行为组织(封装)成一个类(模板) 2. ...
- Docker实战部署应用——MySQL5.7
MySQL 部署 拉取MySQL镜像 拉取命令: docker pull mysql:5.7 查看镜像 docker images 创建 MySQL 容器 docker run -id --name= ...
- const类型总结
const 表示常类型 作用: 1.具有不可变性. 2.可以很方便对参数进行调整和修改,和宏定义一样,不变则已,变都变. 3.保护被修饰的东西,防止被意外修改.(如:在修饰函数的形参时,加 ...