binding - WCF IncludeExceptionDetailInFaults programmatically? -


i have following in config file, , trying find equivalent bits in c#, have service configured programmatically. class/property/method should for?

thanks.

<behaviors>     <servicebehaviors>         <behavior name="servicegatewaybehavior">             <servicemetadata httpgetenabled="true"/>             <servicedebug includeexceptiondetailinfaults="true"/>         </behavior>     </servicebehaviors> </behaviors> 

if want in cases, use servicebehaviorattribute:

   [servicebehavior(includeexceptiondetailinfaults=true)]    class myserviceimplementation : imyservice    {       /// ...    } 

if want in cases, determined @ runtime....

//////////////////////////////////// // must include these @ top of file using system.servicemodel; using system.servicemodel.description; // ...  ///////////////////////////////////////////////////////////// // inside whichever function initializes service host // _servicehost = new servicehost(_service); if (iwanttoincludeexceptiondetails()) {     var behavior = _servicehost.description.behaviors.find<servicedebugbehavior>();     behavior.includeexceptiondetailinfaults = true; } _servicehost.open(); 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -