Reputation: 119
I write c# code, to dynamic connect to WCF server. If connect will less that 1 minutes it's work perfect. But if remote function work more than 1-2 minutes, it's throw exception. This is my code:
try
{
BasicHttpBinding basicHttpBinding = new BasicHttpBinding()
{
CloseTimeout = TimeSpan.FromMinutes(20),
OpenTimeout = TimeSpan.FromMinutes(20),
ReceiveTimeout = TimeSpan.FromMinutes(10),
SendTimeout = TimeSpan.FromMinutes(10)
};
EndpointAddress endpointAddress = new EndpointAddress("http://***");
IBrowserClicker personService = new ChannelFactory<IBrowserClicker>(basicHttpBinding, endpointAddress).CreateChannel();
Console.WriteLine(personService.TestConnect().Equals("Hello google!"));
}
catch (Exception exception)
{
Console.WriteLine("Error:"+exception);
}
Exception:
Error: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 SDK documentation and inspect the server trace logs.
So, how it's fix?
Upvotes: 1
Views: 104
Reputation: 3860
try to turn on IncludeExceptionDetailInFaults in web.config file to see the exact error. and this is possible duplicate of
This explain as follows, and it worked for me. In your .config file define a behavior:
<configuration>
<system.serviceModel>
<serviceBehaviors>
<behavior name="debug">
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
...
Then apply the behavior to your service along these lines:
<configuration>
<system.serviceModel>
...
<services>
<service name="MyServiceName" behaviorConfiguration="debug">
</services>
</system.serviceModel>
</configuration>
Please look at it and let me know if you find trouble to activate it.
Upvotes: 0