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
Post a Comment