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等错误,如果直接返回错误的调用堆栈的具体信息,显然大部分的用户看到是一脸懵逼的 ...
随机推荐
- STL关联容器值hashtable
hashtable(散列表)是一种数据结构,在元素的插入,删除,搜索操作上具有常数平均时间复杂度O(1); hashtable名词 散列函数:负责将某一元素映射为索引. 碰撞(collision):不 ...
- Java第三周总结&实验报告(1)
总结:不知不觉,到了第三周,回顾这一周,我更加深入了解了main方法,除此之外,学习了两个关键字,一个this,一个static,this在强调属性时,只能放在句首且不能循环调用,static声明用于 ...
- 关于mysql的使用命令(持续更新中...)
特别提示 本说明中的mysql 是基于windwos平台下的5.5 版本 安装完成后 请到mysql中设置配置文件 链接分享:链接:https://pan.baidu.com/s/1tv4ulZ ...
- HihoCoder - 1093 小Hi和小Ho (SPFA)
描述 万圣节的晚上,小Hi和小Ho在吃过晚饭之后,来到了一个巨大的鬼屋! 鬼屋中一共有N个地点,分别编号为1..N,这N个地点之间互相有一些道路连通,两个地点之间可能有多条道路连通,但是并不存在一条两 ...
- 防止 iframe 的链接重定向父级页面
项目中发现,多系统通过iframe嵌套时,如果iframe的请求是重定向会导致父级页面重定向,怎么破? 查找MDN(https://developer.mozilla.org/zh-CN/docs), ...
- swiper和tab相结合
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- JUC并发包基本使用
一.简介 传统的Java多线程开发中,wait.notify.synchronized等如果不注意使用的话,很容易引起死锁.脏读问题.Java1.5 版本开始增加 java.util.concurre ...
- Untiy3D学习笔记记录
一,原点和中心点 pivot(原点):位置移动的点(模型的原点不会发生变化) center(中心点):计算模型的中心,会发现变化(比如有两个cube,他的中心点会计算在两个模型的中间) 二,prefa ...
- Angular.js 使用$http的response得到的phone属性为undefined
这是个坑~ 先说解决方案:把response打印出来找你的属性 记录一下,经验不足,有些东西想当然了,所有错误出现都应该一步步去排查!!!切记想当然的自以为. 源码: js $scope.phone= ...
- Vue Cli3 TypeScript 搭建工程
Vue Cli3出来也一段时间了,我想尝试下Vue结合TypeScript搭建个工程,感受下Vue下用TS...网上有一篇讲的非常详细的教程 vue-cli3.0 搭建项目模版教程(ts+vuex+ ...