Computers, Programming, Technology, Music, Literature

Enable WCF help page and exception details in FaultException

leave a comment »



via config file

			<service name="HWService" behaviorConfiguration="metadataAndDebug">
						<add baseAddress="http://localhost:8080/HWService" />
				<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
				<behavior name="metadataAndDebug">
					<serviceMetadata  httpGetEnabled="true" httpGetUrl=""/>
					<serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true" />

via code

ServiceHost host = new ServiceHost(typeof(HWService));

ServiceDebugBehavior debug = host.Description.Behaviors.Find<ServiceDebugBehavior>();

// if not found,  turn the setting on with a behavior
if (debug == null)
         new ServiceDebugBehavior() { IncludeExceptionDetailInFaults = true });
    // make sure setting is on
    if (!debug.IncludeExceptionDetailInFaults)
        debug.IncludeExceptionDetailInFaults = true;



via code (with attribute)


public class HWService : IHWService
	//code šŸ˜‰

Written by gmaran23

March 20, 2013 at 9:39 am

Posted in .Net, C#, WCF

Tagged with , ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: