473,654 Members | 3,115 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WCF: Question about the right usage of FaultReason and FaultCode

Hi,

To protect my WCF service boundaries, I assign a unique support ticket to
all server side exceptions, log them and send a general FaultException to
client that only include the support ticket.

Support ticket is just a GUID that comes along with the exception log at the
server side.

From WCF programming best practice, What would be the best way to send the
support ticket to client? At this point my WCF services send this
FaultException to client:

FaultException fe = new FaultException( new FaultReason(tic ket), new
FaultCode("Logg edServerExcepti on"));

Is this the recommended use of FaultReason and FaultCode? Should I consider
another way to send the ticket# to client application?

Any help would be appreciated,
Max
Jun 27 '08 #1
1 6459
Hi Max,

Regarding on the FaultException in WCF, the document suggest that we define
a custom type which will wrapper all the information that may need to be
carried in the exception(send from server to client) and declare the
"FaultException Attribute" on the certain interface which will throw this
exception(conta ins that custom type object). e.g.

#here [YourCustomType] is the custom type(should be serializable) you
defined(you may embed the guid or other data info in it)
==============
[OperationContra ct]
[FaultContractAt tribute( typeof( YourCustomType ), ....... )]
string SampleMethod(st ring msg);
===========

this will make the service description(met adata) expose the information of
this exception. see the following document, it recommend that you define a
custom type instead of directly using a simple type(such as string):

#FaultException <(Of <(TDetail>)>) Generic Class
http://msdn.microsoft.com/en-us/library/ms576199.aspx

And here are some other web articles which also mentioned the usage of the
FaultException :

#[WCF] Fault contracts
http://bloggingabout.net/blogs/jpsmi...ault-contracts
.aspx

#WCF FaultException ˇ* why use it?
http://dotnet.org.za/willy/archive/2...on-_2620_-why-
use-it_3F00_.aspx
Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsof t.com.

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: "Max2006" <al*******@news group.nospam>
Subject: WCF: Question about the right usage of FaultReason and FaultCode
Date: Wed, 25 Jun 2008 16:29:25 -0400

Hi,

To protect my WCF service boundaries, I assign a unique support ticket to
all server side exceptions, log them and send a general FaultException to
client that only include the support ticket.

Support ticket is just a GUID that comes along with the exception log at
the
server side.

From WCF programming best practice, What would be the best way to send the
support ticket to client? At this point my WCF services send this
FaultException to client:

FaultException fe = new FaultException( new FaultReason(tic ket), new
FaultCode("Logg edServerExcepti on"));

Is this the recommended use of FaultReason and FaultCode? Should I consider
another way to send the ticket# to client application?

Any help would be appreciated,
Max

Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
7787
by: james | last post by:
Does anyone know how to access a WCF service in Internet Explorer? I want to browse to my service to make sure it is returning good data, and I think I am browsing to the wrong address. I have a simple Interface interface IWebService { string Health();
2
6294
by: =?Utf-8?B?QnJhdmVzQ2hhcm0=?= | last post by:
I am not sure if this is the right form because I didn't see any WCF forms. Anyway, I made a very simple WCF object and hosted it in IIS. Now I have a client that builds 20 threads, and have each thread call the WCF object and half the threads work and the other half get: System.ServiceModel.CommunicationObjectFaultedException was caught Message="The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for...
0
3878
by: =?Utf-8?B?aGVyYmVydA==?= | last post by:
This is part of my service contract: <OperationContract(), FaultContract(GetType(String))_ Function AddControlStation(...) As Integer This is part of my the service type in AddControlStation(): Throw New FaultException(New FaultReason("control station on " & port & " already exists."), FaultCode.CreateSenderFaultCode(Nothing)) This is in my client code:
0
1257
by: =?Utf-8?B?S2V2aW4=?= | last post by:
Hi all, I have been struggling to find some descent content on the net about how I could go about creating a mobile client that is able to call a web service(WCF or WSE3.0/2.0??), that can make use of our current ASP.NET Membership infrastructure for Authentication and Authorization. I have read a few articles about how WCF does support this, but I've had absolutely no luck trying to run any samples, because everywhere I turn I need some...
5
2931
by: Jonathan Kay | last post by:
Hi, I'd like to my WCF webservice to work both on SSL and without. Unfortunately searching has led to dead ends, references to changes that only work on the old previous beta versions and I admit I am rather confused and frustrated. That being said, I'd like some direction in how exactly I'm supposed to accomplish this. Thanks very much, JK
1
4560
by: Ragesh Krishna | last post by:
Hello, I'm creating a WCF service in which I use LINQ to SQL to do all my data access. I have a couple of architectural questions about using LINQ to SQL from WCF services: 1) What is the right way to use DataContext in this scenario? The service will obviously be used by multiple clients simultaneously. Should I be creating a "global" DataContext object that I use from within each of
0
3019
by: nicknux | last post by:
This is a modified version of the Microsoft sample code for MessageInspector (InterceptingChannelListener class) . bool ProcessRequestContext(ref RequestContext requestContext) { if (requestContext == null) { return true; }
16
2402
by: =?Utf-8?B?U3RldmUgQmFya2Vy?= | last post by:
WCF Question Hi guys, I’m pretty new to WCF, and have a basic question about how it works. I’m trying to use WCF to write an “SOA-system”, and am having a few problems. The following analogy explains what I’m trying to do. I have a very simple class:
5
5461
by: =?Utf-8?B?TWFyaw==?= | last post by:
I'm researching what is the best way to create a generic WCF proxy wrapper that has the following requirements: 1. Remove the System.ServiceModel config section requirement for clients. We have our own configuration management that follows our application lifecycle (development/system test/production). Also, most of the proxies we build are for the middle-tier layer. 2. Create a wrapper to follow WCF Client best practices (proxy.close...
0
8290
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8815
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8708
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8489
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6161
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4149
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2716
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1916
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.