My WCF service throwing exception. not able to find what is the exception could be.
It throws like this
System.ServiceModel.FaultException: 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
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.
web.config
<system.serviceModel>
<services>
<service name="ServiceName" behaviorConfiguration="debug" />
</services>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_ITwoWayAsync" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://company.com/CustCommPreferences.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ITwoWayAsync"
contract="OptInOutServices.CustCommPreferences" name="BasicHttpBinding_ITwoWayAsync" />
</client>
<behaviors>
<serviceBehaviors>
<behavior name="debug">
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
Looks like I have added ServiceDebug also, Still I am not able to find inner Exception or Stack trace
catch (FaultException ex)
{
string msg = "FaultException: " + ex.Message;
MessageFault fault = ex.CreateMessageFault();
if (fault.HasDetail == true)
{
System.Xml.XmlReader reader = fault.GetReaderAtDetailContents();
if (reader.Name == "ExceptionDetail")
{
ExceptionDetail detail = fault.GetDetail<ExceptionDetail>();
msg += "\n\nStack Trace: " + detail.StackTrace;
}
}
return View("Error");
}