I have all of my connections set up from my code, as opposed to using my config file. How does one go about setting up WCF Tracing on a connection built from code. I tried adding the tracing to the config file, as explained here, but it produces no logs whatsoever.
I need to know either how to make it work from the config file for connections set up in code, or how to configure it manually in code if anyone has any info. Thanks!
EDIT: To add a little more information:
The application is a C# Console application, and my binding is declared as:
private Binding getBinding()
{
NetTcpBinding tcp = new NetTcpBinding();
tcp.ReaderQuotas.MaxArrayLength = 65535;
tcp.TransferMode = TransferMode.Streamed;
tcp.ReaderQuotas.MaxArrayLength = int.MaxValue;
tcp.ReaderQuotas.MaxDepth = int.MaxValue;
tcp.ReaderQuotas.MaxStringContentLength = int.MaxValue;
tcp.ReaderQuotas.MaxBytesPerRead = int.MaxValue;
tcp.ReaderQuotas.MaxNameTableCharCount = int.MaxValue;
tcp.MaxReceivedMessageSize = int.MaxValue;
return tcp;
}
And I then add services to my app using a generic function:
private List<ServiceHost> m_Hosts = new List<ServiceHost>();
private static List<string> m_Services = new List<string>();
public void AddHost<T1, T2>(string uri)
where T1 : class
where T2 : class
{
m_Services.Add("net.tcp://<ipaddress>:<port>/" + uri);
m_Hosts.Add(new ServiceHost(typeof(T1)));
m_Hosts[m_Hosts.Count - 1].AddServiceEndpoint(typeof(T2), getBinding(), m_Services[m_Services.Count - 1]);
}
There's obviously a little more code to make this all work, but this should give any relevant parts.