This issue is related to a WCF hosted in a windows service on a windows server 2003.
The issue happens after several days of correct working and get fixed only by rebooting the server.
The C# code doesn't catch any exception in its log
serviceHost.Opening += new EventHandler(serviceHost_Opening);
serviceHost.Opened += new EventHandler(serviceHost_Opened);
serviceHost.Closing += new EventHandler(serviceHost_Closing);
serviceHost.Closed += new EventHandler(serviceHost_Closed);
serviceHost.Faulted += new EventHandler(serviceHost_Faulted);
serviceHost.UnknownMessageReceived += new EventHandler<UnknownMessageReceivedEventArgs>(serviceHost_UnknownMessageReceived);
serviceHost.Open();
The handlers are implemented like that:
void serviceHost_Opened(object sender, EventArgs e)
{
CentralReport.MyService.SrvLog("WinCentralRpt",String.Format("service opened by sender: {0}", sender.GetType().ToString()));
}
void serviceHost_Opening(object sender, EventArgs e)
{
CentralReport.MyService.SrvLog("WinCentralRpt",String.Format("service opening by sender: {0}", sender.GetType().ToString()));
}
public static void SrvLog(string user, string line) {
string log_path = System.Configuration.ConfigurationManager.AppSettings["srv_log"];
if (log_path != null) {
using (System.IO.StreamWriter logSW = new System.IO.StreamWriter(
log_path.Replace("{user}",user.ToLower()),true)) {
logSW.WriteLine(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt", CultureInfo.InvariantCulture) + ": " + line);
}
}
}
On client side, C# WCF consumer correctly closes the connection, after invoking an operation.
Maximum level tracing has been activated.
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="All"
propagateActivity="true">
<listeners>
<add name="xml" />
</listeners>
</source>
<source name="CardSpace"
switchValue="All">
<listeners>
<add name="xml" />
</listeners>
</source>
<source name="System.IO.Log"
switchValue="All">
<listeners>
<add name="xml" />
</listeners>
</source>
<source name="System.Runtime.Serialization"
switchValue="All">
<listeners>
<add name="xml" />
</listeners>
</source>
<source name="System.IdentityModel"
switchValue="All">
<listeners>
<add name="xml" />
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging"
switchValue="All">
<listeners>
<add name="xml" />
</listeners>
</source>
<source name="System.ServiceModel.Activation"
switchValue="All">
<listeners>
<add name="xml" />
</listeners>
</source>
</sources>
<sharedListeners>
<add name="xml"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="C:\MyPath\Traces.svclog" />
</sharedListeners>
<trace autoflush="true" />
</system.diagnostics>
with
<system.serviceModel>
<diagnostics wmiProviderEnabled="true">
<messageLogging
logEntireMessage="true"
logMalformedMessages="true"
logMessagesAtServiceLevel="true"
logMessagesAtTransportLevel="true"
maxMessagesToLog="3000"
/>
</diagnostics>
and
<serviceBehaviors>
<behavior name="MyServiceBehavior">
<dataContractSerializer maxItemsInObjectGraph="6553500"/>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
Operating system checks seem fine
netstat -ao | grep 9nnn
tasklist /SVC | grep Opxxx
My feeling was that the channel listeners are not working, but nothing shows any issues in the trace log. The server just stops responding to requests for this WCF, but it writes nothing to logs from that moment on. From a visual perspective here it is the non-responding versus the ok graph.
Could someone suggest a softer solution than rebooting the server? Obviously, already tried to restart the host service (and other system services like dns and ipsec) and even reinstalled the WCF. Only rebooting the server does the trick.
Any idea what could be the root cause?
Edit - after the reboot
After the reboot - without any other changes - the WCF started to work again.
Side note
There is another minor point that I don't fully understand. Running now - when everything is working fine - the command
httpcfg.exe query urlacl
that is the windows 2003 version of
netsh http show urlacl
I would have expected to see the WCF url but the output is only (why?)
C:\>httpcfg.exe query urlacl
URL : http://+:80/Temporary_Listen_Addresses/
ACL : D:(A;;GX;;;WD)
-------------------------------------------------------