WCF will be able to send back the status of server and client erroneous condition in Fault messages. However, due to the security consideration, it is commonly disabled on the server side so that normally you are not able to view the server internal information direclty (suppose there are some critical messgaes in the server fault message)..
however, in debug mode, you want to expose the message to the client so that they can know what might go wrong...
You can do that either via the Service Configuration behavior or you may need to have to call in code to enable this behavior..
Enable ServiceDebugBehavior in code programmatically
using (ServiceHost host = new ServiceHost(typeof(TabularPushService))) { host.AddServiceEndpoint( typeof(ITabularPushService), new NetTcpBinding(), string.Format("net.tcp://127.0.0.1:{0}/TabularPushService", arguments.Port)); #if DEBUG ((ServiceDebugBehavior)host.Description.Behaviors[typeof(ServiceDebugBehavior)]).IncludeExceptionDetailInFaults = true; #endif //... }
Add the ServiceBehavior on ServiceContract parameter.
[ServiceBehavior(IncludeExceptionDetailInFaults = true)] public class TabularPushService : ITabularPushService { // ... }
As you can see, you can decorate the service in question with the ServiceBehavior attribute, and then you can supply an value to indicate that IncludeExceptionDetailInFault in the message.
Configure IncludeExceptionDetailInFault via config
In the Sercice endpoint configuraiotn, you can do this:
<?xml version="1.0"?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> </startup> <system.serviceModel> <!-- include more detailed debug information code snippet from : http://stackoverflow.com/questions/5076534/implementing-wcf-using-nettcp-protocol --> <behaviors> <serviceBehaviors> <behavior name="standard"> <serviceDebug includeExceptionDetailInFaults="true"/> </behavior> </serviceBehaviors> </behaviors> <!-- Port will be programmtically determined --> <!-- TabularPushService --> <service name="WcfPub.TabularPushService"> <endpoint address="net.tcp://127.0.0.1:9999/TabularPushService" binding="netTcpBinding" contract="WcfPub.ITabularPushService" behaviorConfiguration="standard"/> </service> </services> </system.serviceModel> </configuration>
as you can see, the most important part to enable the behavior is the "behaviorConfiguration" attribute, which points to the name of the behavior configuration.