Jam*_*mes 11 .net iis wcf exception
我有一个使用DualHttpBindings回调的wcf服务.该服务在找到它们时将客户端(用于长时间运行的搜索)的搜索结果数据推回.
这在.Net 3.5中运行良好.自从我更新到.Net 4.0以来,它实际上杀死了一个实际上杀死了IIS工作进程的System.Runtime.FatalException.我不知道如何开始解决这个问题.任何建议表示赞赏
结果事件日志中的信息粘贴在下面:
发生未处理的异常,并终止该过程.
应用ID:/ LM/W3SVC/2/ROOT/CP
进程ID:5284
>异常:System.Runtime.FatalException
>消息:对象引用未设置为对象的实例.
堆栈跟踪: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. System.Runtime.Fx上System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(IAsyncResult结果)的System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest(RequestContext请求,OperationContext currentOperationContext)上的ChannelHandler.DispatchAndReleasePump(RequestContext请求,Boolean cleanThread,OperationContext currentOperationContext) System.Runtime.AsyncResult上的.AsyncThunk.UnhandledExceptionFrame(IAsyncResult结果).在System.Runtime.InputQueue中完成(Boolean completedSynchronously)
1.AsyncQueueReader.Set(Item item) at System.Runtime.InputQueue1.Disatch()位于System.ServiceModel.Channels.ReliableDuplexSessionChannel.ProcessDuplexMessage(WsrmMessageInfo info)中的System.ServiceModel.Channels.ReliableDuplexSessionChannel.HandleReceiveComplete(IAsyncResult结果),位于System的System.ServiceModel.Channels.ReliableDuplexSessionChannel.OnReceiveCompletedStatic(IAsyncResult结果).位于System.ServiceModel.Channels.ReliableChannelBinder的System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)上的Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult结果)System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame上的1.InputAsyncResultOnInputComplete(IAsyncResult结果)(IAsyncResult) System.Runtime.InputQueue上的System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)1.AsyncQueueReader.Set(Item item) at System.Runtime.InputQueue1.Disatch()在System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32 errorCode,UInt32 numBytes,NativeOverlapped*nativeOverlapped)
处于System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32错误,UInt32 bytesRead,NativeOverlapped*nativeOverlapped)
. Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode,UInt32 numBytes,NativeOverlapped*pOVERLAP)> InnerException: > System.NullReferenceException
消息:对象引用未设置为对象的实例.
StackTrace:位于System.Web.AmpNet上的System.Web.HttpApplication.ThreadContext.Enter(Boolean setImpersonationContext)中的System.Web.HttpApplication.OnThreadEnterPrivate(Boolean setImpersonationContext),位于System.Web.AspNetSynchronizationContext的System.Web.AspNetSynchronizationContext.CallCallbackPossiblyUnderLock(SendOrPostCallback回调,对象状态).System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc&rpc)中的 CallCallback(SendOrPostCallback回调,对象状态 )
Jam*_*mes 15
好的 - 我找到了答案.非常奇怪,但只是在WCF回调包装类上放置以下属性:
[CallbackBehavior(UseSynchronizationContext=false)]
Run Code Online (Sandbox Code Playgroud)
感谢Cauldwell.net的回答:http://www.cauldwell.net/patrick/blog/CategoryView,category,CodeGen.aspx
来自cauldwell.net:
事实证明,问题是ASP.NET使用(默认情况下)称为SynchronizationContext的小东西.尽可能接近(我还没有彻底研究过这个问题),确保任何回调都能在UI线程上运行,从而避免需要调用Control.Invoke.的WinForms.在我的情况下,额外的锁定给了一些适合的东西,并且它试图在一个不再存在的线程上清理东西,因此对NullReferenceException.
| 归档时间: |
|
| 查看次数: |
9123 次 |
| 最近记录: |