2010-09-29 34 views
0

我有一個Web服務託管在不同的方框中的IIS中,WCF服務託管在Windows服務中,在另一個方框中(N層方法)。在這裏,Web服務是WCF服務的客戶端。上傳文件的請求來自IIS託管的Web服務,並且此IIS託管的Web服務作爲迴應調用WCF服務並進行實際上載。到現在爲止還挺好。上傳完成後,WCF服務執行回調(我已將回調存儲在字典中,並且已使用(InstanceContextMode = InstanceContextMode.PerSession,ConcurrencyMode = ConcurrencyMode.Multiple))。 WCF服務發送回調。在跟蹤查看器中,它看起來像ASP.NET收到回調,但瀏覽器中的上載頁面(這是最終用戶)凍結好。 我正在使用larsw的ChunkingChannel綁定。從WCF到ASP.NET的回調可能嗎?

首先,它是在所有可能實現上述塞納里奧,約翰Saundars在這個環節提到:

What does "OperationContext.Current.GetCallbackChannel" actually do?

感謝您的幫助。

回答

0

它被修復了,我重新啓動了計算機,現在我正在客戶端(ASP.NET)端的跟蹤查看器中獲取以下內容,並且該頁面現在不凍結(無響應)。最讓我擔心的消息是它的內部異常:System.NullReferenceException,mscorlib並且說對象引用不是...

我嘗試使用控制檯應用程序作爲WCF服務的客戶端。回調效果很好。只有當我在IIS中託管我的網站並調用WCF服務才能上傳文件(作爲回報調用客戶端來通知上傳是否成功)。

(我正在使用HttpChunkingBinding)。 有什麼想法?

System.Runtime.FatalException, System.Runtime.DurableInstancing,版本= 4.0.0.0,文化=中性 公鑰= 31bf3856ad364e35對象 引用不設置爲一個對象的一個​​實例。 處 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc & RPC)。ProcessMessage31(MessageRpc & RPC)在System.ServiceModel.Dispatcher.MessageRpc.Process(布爾 isOperationContextSet)在 System.ServiceModel.Dispatcher.ChannelHandler.DispatchAndReleasePump(RequestContext的 請求,布爾cleanThread,的OperationContext currentOperationContext)在 System.ServiceModel .Dispatcher.ChannelHandler.HandleRequest(的RequestContext 請求,的OperationContext currentOperationContext)處 系統 System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(IAsyncResult的 結果)在 System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult的 結果)。 SERV iceModel.Diagnostics.TraceUtility。 < > c_ DisplayClass4。 <CallbackGenerator> b處 System.ServiceModel.Channels.ReliableDuplexSessionChannel System.Runtime.InputQueue 1.AsyncQueueReader.Set(Item item) at System.Runtime.InputQueue 1.Dispatch()_2(的AsyncCallback 回調,IAsyncResult的結果)在 System.Runtime.AsyncResult.Complete(布爾completedSynchronously)。 ProcessDuplexMessage(WsrmMessageInfo 信息)在 System.ServiceModel.Channels.ReliableDuplexSessionChannel.HandleReceiveComplete在 System.ServiceModel.Channels.ReliableDuplexSessionChannel.OnReceiveCompletedStatic(IAsyncResult的 結果)(IAsyncResult的 結果)在 System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame( IAsyncResul在System.Runtime.AsyncResult.Complete(布爾 completedSynchronously)在 System.ServiceModel.Channels.ReliableChannelBinder 1.InputAsyncResult 1.OnInputComplete(IAsyncResult的 結果)在 System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult的 結果噸 結果) )在 System.ServiceModel.Diagnostics.TraceUtility。 < > c_ DisplayClass4。 <CallbackGenerator> b在 System.Runtime.InputQueue 1.AsyncQueueReader.Set(Item item) at System.Runtime.InputQueue 1.Dispatch()在 System.Runtime.ActionItem.DefaultActionItem _2(的AsyncCallback 回調,IAsyncResult的結果)在 System.Runtime.AsyncResult.Complete(布爾completedSynchronously)。調用()處 System.Runtime.Fx System.Runtime.ActionItem.CallbackHelper.InvokeWithoutContext(對象 狀態)在 System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32的 的errorCode,UInt32的的numBytes,NativeOverlapped * nativeOverlapped)。 IOCompletionThunk.UnhandledExceptionFrame(UInt32 錯誤,UInt32 bytesRead,NativeOverlapp ED * nativeOverlapped)在 System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32的 的errorCode,UInt32的的numBytes,NativeOverlapped * pOVERLAP) System.Runtime.FatalException:對象沒有 設置爲一個對象的一個​​實例。 --- > System.NullReferenceException:對象引用未設置爲對象的實例 。在 System.Web.HttpApplication.ThreadContext.Enter在 系統(布爾 setImpersonationContext)在 System.Web.HttpApplication.OnThreadEnterPrivate(布爾 setImpersonationContext)在 System.Web.AspNetSynchronizationContext.CallCallbackPossiblyUnderLock(SendOrPostCallback 回調,對象狀態) .Web.AspNetSynchronizationContext。CallCallback(SendOrPostCallback 回調,對象狀態)在 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc & RPC)---內部異常堆棧跟蹤的末尾在 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4( MessageRpc & RPC)處 System.ServiceModel.Dispatcher.ChannelHandler.DispatchAndReleasePump System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc & RPC)在System.ServiceModel.Dispatcher.MessageRpc.Process(布爾 isOperationContextSet)(RequestContext的 請求,布爾cleanThread,操作onContext在 System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame currentOperationContext)在 System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest(RequestContext的 請求,的OperationContext currentOperationContext)在 System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(IAsyncResult的 結果) (IAsyncResult 結果)在 System.ServiceModel.Diagnostics.TraceUtility。 < > c_ DisplayClass4。 <CallbackGenerator> b _2(的AsyncCallback 回調,IAsyncResult的結果)在 System.Runtime.AsyncResult.Complete(布爾completedSynchronously)
在System.Runtime.InputQueue 1.AsyncQueueReader.Set(Item item) at System.Runtime.InputQueue 1.Dispatch()在 System.ServiceModel.Channels.ReliableDuplexSessionChannel .ProcessDuplexMessage(WsrmMessageInfo 信息)在 System.ServiceModel.Channels.ReliableDuplexSessionChannel.HandleReceiveComplete(IAsyncResult的 結果)在 System.ServiceModel.Channels.ReliableDuplexSessionChannel.OnReceiveCompletedStatic(IAsyncResult的 結果)在 System.Runtime.Fx.AsyncThunk.UnhandledE xceptionFrame(IAsyncResult的 結果)在System.Runtime.AsyncResult.Complete(布爾 completedSynchronously)在 System.ServiceModel.Channels.ReliableChannelBinder 1.InputAsyncResult 1.OnInputComplete(IAsyncResult的 結果)在 System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult的 結果)在 System.ServiceModel.Diagnostics.TraceUtility。 < > c_ DisplayClass4。 <CallbackGenerator> b _2(的AsyncCallback 回調,IAsyncResult的結果)在 System.Runtime.AsyncResult.Complete(布爾completedSynchronously)
在System.Runtime.InputQueue 1.AsyncQueueReader.Set(Item item) at System.Runtime.InputQueue 1.Dispatch()在 System.Runtime.ActionItem.DefaultActionItem .Invoke()在 System.Runtime.ActionItem.CallbackHelper.InvokeWithoutContext(對象 狀態)在 System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32的 的errorCode,UInt32的的numBytes,nativeOverlapped * nativeOverlapped)在 System.Runtime.Fx .IOCompletionThunk.UnhandledExceptionFrame(UInt32 錯誤,UInt32 bytesRead,NativeOverlapped * nativeOverlapped)在 System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32的 的errorCode,UInt32的的numBytes,NativeOverlapped * pOVERLAP) System.NullReferenceException,mscorlib程序, 版本= 4.0.0.0,文化=中性 公鑰= b77a5c561934e089對象 引用未設置爲對象的實例。 在System.Web.HttpApplication.ThreadContext.Enter(布爾 setImpersonationContext)在 System.Web.HttpApplication.OnThreadEnterPrivate(布爾 setImpersonationContext)在 System.Web.AspNetSynchronizationContext.CallCallbackPossiblyUnderLock(SendOrPostCallback 回調,對象狀態)在 系統在 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc & RPC)System.NullReferenceException .Web.AspNetSynchronizationContext.CallCallback(SendOrPostCallback 回調,對象狀態): 對象引用不設置爲一個對象的一個​​實例。在 System.Web.HttpApplication.ThreadContext.Enter在 系統(布爾 setImpersonationContext)在 System.Web.HttpApplication.OnThreadEnterPrivate(布爾 setImpersonationContext)在 System.Web.AspNetSynchronizationContext.CallCallbackPossiblyUnderLock(SendOrPostCallback 回調,對象狀態) .Web.AspNetSynchronizationContext.CallCallback(SendOrPostCallback 回調,對象狀態)在 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc & RPC)

+1

嗯,這個問題爲r由Allen Chen - MSFT解決。 http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/5edef384-eb64-4430-990f-fc149d40cb21/#4f93edd3-36a6-43a3-96b2-969b5903f563 – 2010-10-01 14:43:16

0

不確定你的意思是「凍結」,只是它沒有更新或者它沒有響應。

在響應從wcf服務返回到Web服務器之前,可能會將asp頁面的響應發送到瀏覽器。在這種情況下,當服務返回結果時,asp頁面不會被更新。

你有2種選擇:

  • 使用JavaScript來輪詢更改服務器。
  • 阻止上載頁面的返回,直到從服務收到響應。

如果最終等待回調,那麼只需要做一個請求響應樣式就簡單了。

另一個常見問題是客戶端上的wcf代理在收到回調之前會關閉。痕跡會顯示它回來,但沒有人在聽。