我有一個包含三個項目的解決方案。 與我的MVC應用程序,Silverlight應用程序和(Silverlight啓用)WCF服務項目的主項目。我需要幫助解決WCF服務中相當奇怪的錯誤
在我的silverlight項目中,我已經向我的WCF服務提供了服務引用。 而我幾乎得到了這個工作。
在我的WCF服務中,我有一個返回Book對象的方法,它有一些隨機字段,如標題,日期等。 在book類中,我有一個包含事件列表的ICollection字段。
書類是使用實體框架4.0生成的,並且啓用了延遲加載。
如果我在我的getBook(int id)方法中返回一個事件字段沒有初始化的書,它就像一個魅力一樣。
但是,如果我初始化該字段,我得到這個錯誤。
The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.
我有幾個想法,爲什麼發生這種情況,而寫這個我只是得到了另一個。
wcf服務以某種方式拋棄了對事件類的引用。 這將是非常奇怪的,因爲我有我的主要mvc應用程序(與模型)和我的WCF服務之間的參考。
因爲我已經在EF 4.0中啓用延遲加載,我懷疑它可能是產生錯誤的東西。 但我不知道爲什麼會這樣,因爲我不以任何方式訪問該字段。我可以理解,因爲書對象和實體框架之間的連接就像斷開一樣,我在我的Silverlight應用程序中收回對象後,可能無法訪問事件字段。
我提到在我的EF實例上啓用了延遲加載嗎? 並且在拋出的異常中沒有內部異常。
編輯: 這是(我認爲)在服務器上的例外。
底層連接已關閉:連接意外關閉。
服務器堆棧跟蹤: 在System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(引發WebException引發WebException,HttpWebRequest的請求,HttpAbortReason abortReason) 在System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(時間跨度超時) 在System.ServiceModel.Channels.RequestChannel.Request(消息消息,TimeSpan超時) at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(消息消息,TimeSpan超時) at System.ServiceModel.Channels.ServiceChannel.Call(String action,Boolean單向,ProxyOperationRuntime操作,Object [] ins,Object []輸出,TimeSpan超時) at System.ServiceModel.Channels .ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall,ProxyOperationRuntime操作) at System.ServiceModel.Channels.ServiceChannelProxy。調用(即時聊天消息)在
異常重新拋出[0]: 在System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(即時聊天reqMsg,即時聊天retMsg) 在System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke( MessageData & MSGDATA,的Int32類型) 在RemoteProvider.getTimeline(的Int32 ID) 在RemoteProviderClient.getTimeline(的Int32 ID)
內部異常: 基礎連接已關閉:連接被意外關閉。 在System.Net.HttpWebRequest.GetResponse() 在System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(時間跨度超時)
預先感謝。 馬爾特巴登漢森
服務代碼,請。你需要檢查* server *上發生的異常,當你看到這個時,它將無助於查看* client *異常。 – Aaronaught 2010-03-28 17:21:15
在vs中調試時,我只收到上述異常。我不太清楚如何訪問服務器上發生的異常。 – Moulde 2010-03-28 17:31:01