2010-06-02 29 views
11

DualHttpBindings ile geri aramaları kullanan bir wcf hizmeti var. Servis, arama sonuçlarının bir veri tabanını (uzun süren bir arama için) buldukları şekilde geri gönderir.wcf geri arama istisnası .net 4.0'a güncellendikten sonra

Bu, .NET 3.5'de sorunsuz çalıştı. .NET 4.0'a güncellediğimden beri, IIS çalışan işlemini gerçekten öldüren System.Runtime.FatalException ile bombalanıyor. Bunu düzeltmeye nasıl başlayacağımı bile bilmiyorum. Herhangi bir öneri takdir edildi.

Elde edilen etkinlik günlükleri bilgileri

altında yapıştırılır:


işlenmemiş bir özel durum meydana

ve işlemi sona erdirildi.

Başvuru numarası:/LM/W3SVC/2/KÖK/CP

işlem numarası: 5284

> durum: System.Runtime.FatalException

> Mesaj: nesne başvurusu Bir nesnenin bir örneğini olarak ayarlamayın.

StackTrace: System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31 (MessageRpc & RPC) en System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4 (MessageRpc & RPC) en System.ServiceModel.Dispatcher de System.ServiceModel.Dispatcher.ChannelHandler.DispatchAndReleasePump de .MessageRpc.Process (Boolean isOperationContextSet) (RequestContext istek, Boole cleanThread, OperationContext currentOperationContext) System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest (RequestContext talebi, System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame en System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump de OperationContext currentOperationContext) (ıasyncresult sonuç) System.ServiceModel.Channels.ReliableDuplexSessionChannel.ProcessDuplexMessage de System.Runtime.InputQueue 1.AsyncQueueReader.Set(Item item) at System.Runtime.InputQueue 1.Dispatch() (WsrmMessageInfo bilgi) en System.Runtime.AsyncResult.Complete (Boolean completedSynchronously) 'den (ıasyncresult sonuç) System.ServiceModel.Channels.ReliableDuplexSessionChannel.HandleReceiveComplete Sistemine System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame de System.ServiceModel.Channels.ReliableDuplexSessionChannel.OnReceiveCompletedStatic (IAsyncResult sonuç) (ıasyncresult sonuç) olarak (ıasyncresult sonuç) .Runtime.AsyncResult.Complete System.Runtime.Fx.AsyncThunk de System.ServiceModel.Channels.ReliableChannelBinder 1.InputAsyncResult 1.OnInputComplete de (Boolean completedSynchronously) (ıasyncresult sonucu). System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback (Uınt32 errorCode de System.Runtime.InputQueue 1.AsyncQueueReader.Set(Item item) at System.Runtime.InputQueue 1.Dispatch() de System.Runtime.AsyncResult.Complete (Boolean completedSynchronously) de UnhandledExceptionFrame (ıasyncresult sonuç), Uınt32 numBytes, NativeOverlapped * nativeOverlapped) System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame (Uınt32 hataya
, Uınt32 bytesRead, NativeOverlapped * nativeOverlapped) System.Threading._IOCompletionCa de
llback.PerformIOCompletionCallback (Uınt32 errorInfo, Uınt32 numBytes, NativeOverlapped * pOVERLAP)

> InnerException: > System.NullReferenceException

Mesaj: nesne başvurusu bir örneği ayarlanmadı nesne.

StackTrace: System.Web.HttpApplication.ThreadContext.Enter de (Boolean setImpersonationContext) System.Web.AspNetSynchronizationContext.CallCallbackPossiblyUnderLock de System.Web.HttpApplication.OnThreadEnterPrivate (Boolean setImpersonationContext) 'den (SendOrPostCallback System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4 (MessageRpcde System.Web.AspNetSynchronizationContext.CallCallback (SendOrPostCallback geri arama, nesne state) geri arama, nesne durumu) rpc)

cevap

15

Tamam - Ben cevabı buldum. cevap için Cauldwell.net için

[CallbackBehavior(UseSynchronizationContext=false)] 

Teşekkür: Çok Tuhaf, ama sadece WCF geri arama sarıcı sınıfı aşağıdaki özniteliği koymak

sorun: cauldwell.net itibaren http://www.cauldwell.net/patrick/blog/CategoryView,category,CodeGen.aspx

bu (varsayılan olarak) ASP.NET kullanımları biraz şey SynchronizationContext denilen, oldu çıktı. Ben anlatmak Olarak yakın bir bunun işler herhangi geri aramaları UI iş parçacığı üzerinde çalıştırmak olsun emin olmak için var (ben iyice bu araştırılmış değil, dürüst olmak gerekirse), böylece Kontrol çağırmak gerek kalmıyor Eğer WinForms yaptığım gibi .Invoke. Benim durumumda, bu ek kilit bir şey veriyordu ve NullReferenceException için daha fazla, etrafında olmayan bir iş parçacığı üzerinde şeyler temizlemeye çalışıyordu.

+0

+1 oy. teşekkürler James, benim zamanımı :) hile yaptı –

+0

tasarruf edin!Her ne kadar senaryonum bu istisna yönteminden önce istisnanın atıldığı anlamında makaleden biraz farklı olsa da. – Jan