The WCF Server is hosted on a Windows service. We are getting the following error Sporadically. I am sure that this is not an application error and is thrown within the WCF Framework when closing a connection. Anybody has seen this before and had luck fixing it please share. Any help is highly appreciated.
System.NullReferenceException: Object reference not set to an instance of an object.
Server stack trace:
at System.Threading.Overlapped.Free(NativeOverlapped* nativeOverlappedPtr)
at System.ServiceModel.Channels.OverlappedContext.Free()
at System.ServiceModel.Channels.OverlappedContext.FreeOrDefer()
at System.ServiceModel.Channels.SocketConnection.Abort(TraceEventType traceEventType, String timeoutErrorString, TransferOperation transferOperation)
at System.ServiceModel.Channels.SocketConnection.Abort()
at System.ServiceModel.Channels.DelegatingConnection.Abort()
at System.ServiceModel.Channels.ConnectionPool.AbortItem(IConnection item)
at System.ServiceModel.Channels.IdlingCommunicationPool\`2.IdleTimeoutEndpointConnectionPool.AbortItem(TItem item)
at System.ServiceModel.Channels.CommunicationPool\`2.EndpointConnectionPool.ReturnConnection(TItem connection, Boolean connectionIsStillGood, TimeSpan timeout)
at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
Following is the excerpt from the client side.
public DateTime GetLastReferenceDataRefreshedTime()
{
RfaReferenceServiceProxy serviceProxy = null;
try
{
serviceProxy = SafeProxy();
return serviceProxy.Channel.GetLastReferenceDataRefreshedTime();
}
catch (CommunicationException exception)
{
Log.Error("Retrying after communication exception:" + exception.Message);
return SafeProxy().Channel.GetLastReferenceDataRefreshedTime();
}
}