我有一个使用DualHttpBindings的WCF服务,其中包含回调。该服务在找到搜索结果时向客户端(长时间运行的搜索)推送搜索结果的datatable。
在.NET 3.5中,这个功能运行良好。自从我升级到.NET 4.0以后,它出现了System.Runtime.FatalException错误,并且实际上导致IIS工作进程关闭。我都不知道如何开始修复。欢迎任何建议。
以下是事件日志的信息:
System.ServiceModel.Channels.ReliableDuplexSessionChannel.OnReceiveCompletedStatic(IAsyncResult result) 在 System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result) 内部处理未捕获的异常,在 System.ServiceModel.Channels.ReliableChannelBinder发生未处理的异常,进程已终止。
应用程序ID: / LM / W3SVC / 2 / ROOT / CP
进程ID: 5284
> 异常: System.Runtime.FatalException
> 消息:对象引用未设置对象实例。
StackTrace: at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet) at System.ServiceModel.Dispatcher.ChannelHandler.DispatchAndReleasePump(RequestContext request, Boolean cleanThread, OperationContext currentOperationContext) at System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest(RequestContext request, OperationContext currentOperationContext) at System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(IAsyncResult result) at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result) at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously) at System.Runtime.InputQueue
1.AsyncQueueReader.Set(Item item) at System.Runtime.InputQueue
1.Dispatch() at System.ServiceModel.Channels.ReliableDuplexSessionChannel.ProcessDuplexMessage(WsrmMessageInfo info) at System.ServiceModel.Channels.ReliableDuplexSessionChannel.HandleReceiveComplete(IAsyncResult result) at
1.InputAsyncResult
1.OnInputComplete(IAsyncResult result) 内完成输入操作,然后在
System.Runtime.InputQueue1.AsyncQueueReader.Set(Item item) 之内设置Item项。接着在
System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped) 内进行调度,最后在
System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP) 中执行IO完成回调。
InnerException: System.NullReferenceException
消息:对象引用未设置为对象的实例。
StackTrace: 在 System.Web.HttpApplication.ThreadContext.Enter(Boolean setImpersonationContext) 中进入线程上下文,在 System.Web.HttpApplication.OnThreadEnterPrivate(Boolean setImpersonationContext) 处于私有状态时调用,然后在 System.Web.AspNetSynchronizationContext.CallCallbackPossiblyUnderLock(SendOrPostCallback callback, Object state) 或 System.Web.AspNetSynchronizationContext.CallCallback(SendOrPostCallback callback, Object state) 调用回调函数。最后在 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc) 中处理消息。