Reputation: 1624
I have simple service which is consumed by 3rd software. When this software is trying to communicate with my service there is an exception raised somewhere deep in .net "A first chance exception of type 'System.Runtime.Serialization.SerializationException' occurred in System.ServiceModel.dll". I am unable to catch it anywhere so I am not able to determinate what is wrong. Can somebody give me a hint how to get more details about this exception?
Here is a simplified code for service staff.
_serverHost = new ServiceHost(typeof (Service), baseAddress);
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
_serverHost.Description.Behaviors.Add(smb);
var binding = new BasicHttpBinding() {MaxReceivedMessageSize = 2147483647, SendTimeout = TimeSpan.FromMinutes(10), ReceiveTimeout = TimeSpan.FromMinutes(10)};
binding.ReaderQuotas.MaxDepth = 2147483647;
binding.ReaderQuotas.MaxStringContentLength = 2147483647;
binding.ReaderQuotas.MaxArrayLength = 2147483647;
binding.ReaderQuotas.MaxBytesPerRead = 2147483647;
binding.ReaderQuotas.MaxNameTableCharCount = 2147483647;
binding.Security.Mode = BasicHttpSecurityMode.None;
var eA = new EndpointAddress(baseAddress);
var serviceEndpoint = new ServiceEndpoint(ContractDescription.GetContract(typeof (IService)), binding, eA);
_serverHost.AddServiceEndpoint(serviceEndpoint);
_serverHost.Open();
[ServiceContract]
public interface IService
{
[OperationContract]
int Method(int input);
}
public class Service : IService
{
public int Method(int input)
{
return input + 42;
}
}
Upvotes: 1
Views: 459
Reputation: 1624
Solution is pretty simple.
static class Program
{
[STAThread]
private static void Main()
{
AppDomain.CurrentDomain.FirstChanceException += CurrentDomainOnFirstChanceException;
...
}
private static void CurrentDomainOnFirstChanceException(object sender, FirstChanceExceptionEventArgs e)
{
//look into exception :-)
}
}
Upvotes: 1