Note that there are some explanatory texts on larger screens.

plurals
  1. POCustom fault exception causing a wcf timeout on the client
    primarykey
    data
    text
    <p>I followed the same example on how to create a custom fault exception (by creating an Exception class and referencing it in the FaultContract), however every time I try to throw the exception from the server, I receive a connection timeout from the client and the connection is closest. The weird thing, if I use the default FaultException class to throw an error from the server, then the client receive it correctly.</p> <p>here's a snippet:</p> <pre><code>[DataContract(Namespace = "http://MyApp.Common", Name = "WcfException")] public class WcfException { private string methodName; private string nameSpace; private string errorDescription; private string stackTrace; private System.Exception exCeption; public WcfException() { methodName = String.Empty; nameSpace = String.Empty; errorDescription = String.Empty; stackTrace = String.Empty; exCeption = null; } [DataMember] public System.Exception MethodException { get { return exCeption; } set { exCeption = value; errorDescription = exCeption.Message; stackTrace = exCeption.StackTrace; } } // and so on.... </code></pre> <p>I initialize the server like this:</p> <pre><code> Type serviceType = typeof(Proxy); Uri baseUri = new Uri(@"net.tcp://" + Environment.MachineName + ":8030/"); NetTcpBinding Binding = new NetTcpBinding(); serviceHost = new ServiceHost(serviceType, baseUri); ServiceMetadataBehavior behavior = new ServiceMetadataBehavior(); serviceHost.Description.Behaviors.Add(behavior); ServiceDebugBehavior sdb = serviceHost.Description.Behaviors.Find&lt;ServiceDebugBehavior&gt;(); sdb.IncludeExceptionDetailInFaults = true; Binding.Name = "ConfigurationHttpChannel"; Binding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard; Binding.Security.Mode = SecurityMode.None; Binding.ReceiveTimeout = new TimeSpan(0, 10, 0); Binding.SendTimeout = new TimeSpan(0, 10, 0); Binding.OpenTimeout = new TimeSpan(0, 10, 0); Binding.CloseTimeout = new TimeSpan(0, 10, 0); Binding.MaxReceivedMessageSize = 65536; Binding.MaxBufferSize = 65536; Binding.MaxBufferPoolSize = 524288; Binding.TransferMode = TransferMode.Buffered; serviceHost.AddServiceEndpoint(typeof(IProxy), Binding, "MyApi"); serviceHost.AddServiceEndpoint(typeof(IMetadataExchange), Binding, "mex"); serviceHost.Open(); </code></pre> <p>Any idea why I am getting a connection timeout Only when i use the custom exception?</p> <p>Many thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload