I have an AJAX-Enabled WCF service. I think I'm passing a parameter incorrectly to one of the operations and the WCF service is returning the following response:
{"ExceptionDetail":null,"ExceptionType":null,"Message":"The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from
the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.","StackTrace":null}
I googled this and I'm supposed to include the following node for the service behavior:
I've done this but I'm still getting the same above error response from the WCF service. Here is the full service configuration from my Web.config. What do I need to do to fix this so I can start receiving valid error messages?
Set IncludeExceptionDetailInFaults to
true to enable exception information to flow to clients for debugging purposes. This property requires a binding that supports either request-response or duplex messaging.
This is how the json param is defined in my js: data: {programId: myProgramId }
This is how the json param is shown in the FireBug request:
"programId=1"
I've tried different variations of the parameter format
and I think it has something to do with the parameter because the wcf service works when I change it to not accept a parameter.
"This property requires a binding that supports either
request-response or duplex messaging."
The service is configured with webHttpBinding - that should support "includeExceptionDetailInFaults" right?
dotnetterAMG...
Member
234 Points
510 Posts
includeExceptionDetailInFaults not working
Jun 18, 2011 12:10 AM|LINK
I have an AJAX-Enabled WCF service. I think I'm passing a parameter incorrectly to one of the operations and the WCF service is returning the following response:
{"ExceptionDetail":null,"ExceptionType":null,"Message":"The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.","StackTrace":null}
I googled this and I'm supposed to include the following node for the service behavior:
<serviceDebug includeExceptionDetailInFaults="true"/>
I've done this but I'm still getting the same above error response from the WCF service. Here is the full service configuration from my Web.config. What do I need to do to fix this so I can start receiving valid error messages?
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="DataServiceBehaviors">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="DataServiceAspNetAjaxBehavior">
<enableWebScript/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
<services>
<service name="DataService">
<endpoint address="" behaviorConfiguration="DataServiceAspNetAjaxBehavior" binding="webHttpBinding" contract="DataService"/>
</service>
</services>
</system.serviceModel>
Ken Tucker
All-Star
16797 Points
2608 Posts
MVP
Re: includeExceptionDetailInFaults not working
Jun 18, 2011 01:15 AM|LINK
From the msdn documents
Set IncludeExceptionDetailInFaults to true to enable exception information to flow to clients for debugging purposes. This property requires a binding that supports either request-response or duplex messaging.
http://msdn.microsoft.com/en-us/library/system.servicemodel.servicebehaviorattribute.includeexceptiondetailinfaults.aspx
Why don't you use something like fiddler to see what is being passed to the web service?
Space Coast .Net User Group
dotnetterAMG...
Member
234 Points
510 Posts
Re: includeExceptionDetailInFaults not working
Jun 18, 2011 01:56 AM|LINK
I'm viewing the script request in FireBug.
This is how the json param is defined in my js: data: {programId: myProgramId }
This is how the json param is shown in the FireBug request: "programId=1"
I've tried different variations of the parameter format and I think it has something to do with the parameter because the wcf service works when I change it to not accept a parameter.
"This property requires a binding that supports either request-response or duplex messaging."
The service is configured with webHttpBinding - that should support "includeExceptionDetailInFaults" right?
Peter pi - M...
Star
12871 Points
1786 Posts
Re: includeExceptionDetailInFaults not working
Jun 22, 2011 08:54 AM|LINK
Hi dotnetterAMG123,
The webHttpBinding based on http request-response mechanism,so it support includeExceptionDetailInFaults.
1,You can remove the name attribute from behavior tag under serviceBehaviors conifguration.
<serviceBehaviors>
<behavior name="DataServiceBehaviors"> <!--delete name="DataServiceBehaviors" -->
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
2,You can also add a behaviorConfiguration attribute to your service element referencing your DataServiceBehaviors behavior.
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="DataServiceBehaviors">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="DataServiceAspNetAjaxBehavior">
<enableWebScript/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
<services>
<service name="DataService" behaviorConfiguration="DataServiceBehaviors">
<endpoint address="" behaviorConfiguration="DataServiceAspNetAjaxBehavior" binding="webHttpBinding" contract="DataService"/>
</service>
</services>
</system.serviceModel>
Best regards,
Peter
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework