In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
What is the solution to the WCF exception? aiming at this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.
First of all, I think this is a very useful plug-in, if it continues to be improved and enhanced, I think it will be used by more developers. Learning the WCF exception source code is very helpful for us to master how to correctly create the WCF exception plug-in project, and we can also learn a lot of programming skills, such as delegate and template methods. I hope you can study it together.
By default, when an exception occurs on the server side, the client gets a default Exception, but the detailed exception information is not included in this Exception instance. Just tell the client that the server is not working properly. In server-and client-mode programs, in some cases, the service startup cannot fully trust the client.
For example, between the browser and the web server, in order to prevent the illegal client from getting more detailed information of the server from the exception message, so that the malicious people can take advantage of it, so the service startup is usually vague about the exception return. The WCF exception also uses this approach, and by default, the exception it returns to the client only tells me what went wrong, but not where he went wrong. This is usually applied to production environments where the client comes from an unknown source to protect the service program.
If you want the message to be more friendly, you can set the return of specific exception information through IncludeExceptionDetailInFaults=True, so that you can tell the client that the service has gone wrong and indicate where the error is. In the program development phase or in some applications, the client is trusted, and the WCF exception is used to give the client a more detailed understanding of what is wrong with the server.
WCF exceptions also support sending detailed error messages to the client, which is more convenient for application debugging. There are two ways to return detailed exceptions: *: by setting: in the server's configuration file, and the second way is by specifying: [ServiceBehavior (IncludeExceptionDetailInFaults=true)] in the code.
In WCF exceptions, more detailed exception messages are also supported, which convey more content through a custom exception message FaultMessage. WCF uses the general Soap Fault to handle exceptions, and provides two types, FaultException and FaultException, to describe and manipulate exceptions.
Communication is abnormal, which is usually due to link reasons, such as service failure, network congestion and so on. Such exceptions are CommunicationException or its derived classes
2) State exceptions, which are usually related to the instance pattern mentioned above, and are thrown when a destroyed server object is accessed, usually ObjectDisposedException
3) Service exceptions are triggered by the server according to specific business logic. It is usually worth noting that when a service exception is thrown, different instance patterns handle it differently:
PerSession: in this mode, if an exception is thrown, the service instance will be terminated, the client will throw FaultException, and the client proxy object cannot continue to use PerCall. In this mode, if an exception is thrown, the service instance will also be terminated. The client proxy object cannot continue to use Single: in this mode, an exception is thrown and the service instance will run as usual. The client agent can no longer be used.
This is the answer to the question about what the solution to the WCF exception is. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.