亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

調用wcf 基礎連接已經關閉: 連接被意外關閉。

調用wcf 基礎連接已經關閉: 連接被意外關閉。

白豬掌柜的 2018-12-07 03:24:57
服務端的代碼 var roles = from re in db.Roles ? select re;? ? ? ? ? ? ? ?? return roles.ToList(); 調試的時候能進入服務端代碼,并能查到正確數據返回,數據量才二條,返回的數據大小不會超過默認設置的大小的。 但是在客戶端就會報出異常,調用wcf 基礎連接已經關閉: 連接被意外關閉。 未處理 System.ServiceModel.CommunicationException? Message=基礎連接已經關閉: 連接被意外關閉。? Source=mscorlib? StackTrace:? ? Server stack trace:?? ? ? ?在 System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)? ? ? ?在 System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)? ? ? ?在 System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)? ? ? ?在 System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)? ? ? ?在 System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)? ? ? ?在 System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)? ? ? ?在 System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)? ? Exception rethrown at [0]:?? ? ? ?在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)? ? ? ?在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)? ? ? ?在 Ship.PurviewWCFService.IPurviewService.GetAllRole()? ? ? ?在 Ship.PurviewWCFService.PurviewServiceClient.GetAllRole() 位置 D:\WorkSpace\Shipmvc\Ship\Ship\Service References\PurviewWCFService\Reference.cs:行號 780? ? ? ?在 Ship.Purview.PurivewMain.BindRole() 位置 D:\WorkSpace\Shipmvc\Ship\Ship\Purview\PurivewMain.cs:行號 381? ? ? ?在 Ship.Purview.PurivewMain.角色管理ToolStripMenuItem_Click(Object sender, EventArgs e) 位置 D:\WorkSpace\Shipmvc\Ship\Ship\Purview\PurivewMain.cs:行號 423? ? ? ?在 System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)? ? ? ?在 System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)? ? ? ?在 System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)? ? ? ?在 System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)? ? ? ?在 System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)? ? ? ?在 System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)? ? ? ?在 System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)? ? ? ?在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)? ? ? ?在 System.Windows.Forms.Control.WndProc(Message& m)? ? ? ?在 System.Windows.Forms.ScrollableControl.WndProc(Message& m)? ? ? ?在 System.Windows.Forms.ToolStrip.WndProc(Message& m)? ? ? ?在 System.Windows.Forms.MenuStrip.WndProc(Message& m)? ? ? ?在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)? ? ? ?在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)? ? ? ?在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)? ? ? ?在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)? ? ? ?在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)? ? ? ?在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)? ? ? ?在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)? ? ? ?在 System.Windows.Forms.Application.Run(Form mainForm)? ? ? ?在 Ship.Program.Main() 位置 D:\WorkSpace\Shipmvc\Ship\Ship\Program.cs:行號 19? ? ? ?在 System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)? ? ? ?在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)? ? ? ?在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()? ? ? ?在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)? ? ? ?在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)? ? ? ?在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)? ? ? ?在 System.Threading.ThreadHelper.ThreadStart()? InnerException: System.Net.WebException? ? ? ?Message=基礎連接已經關閉: 連接被意外關閉。? ? ? ?Source=System? ? ? ?StackTrace:? ? ? ? ? ? 在 System.Net.HttpWebRequest.GetResponse()? ? ? ? ? ? 在 System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)? ? ? ?InnerException:? 請教園子里的兄弟,幫忙提示一下
查看完整描述

8 回答

?
天涯盡頭無女友

TA貢獻1831條經驗 獲得超9個贊

客戶端和服務器的數據契約引用不一致? 而客戶端又沒有自動生成數據契約??

查看完整回答
反對 回復 2019-01-21
?
侃侃無極

TA貢獻2051條經驗 獲得超10個贊

幫你頂頂,怎么都木有人。。

查看完整回答
反對 回復 2019-01-21
?
一只甜甜圈

TA貢獻1836條經驗 獲得超5個贊

謝謝!
查看完整回答
反對 回復 2019-01-21
?
蠱毒傳說

TA貢獻1895條經驗 獲得超3個贊

是的,和序列化相關,你可以通過wcf診斷工具來查找關鍵錯誤信息,從服務器的跟蹤信息中應該可以看到序列化失敗的異常。

查看完整回答
反對 回復 2019-01-21
?
翻翻過去那場雪

TA貢獻2065條經驗 獲得超14個贊

db.ObjectTrackingEnabled = false;
就可以了。
查看完整回答
反對 回復 2019-01-21
?
慕俠2389804

TA貢獻1719條經驗 獲得超6個贊

哥們? 你的這個問題解決沒?

查看完整回答
反對 回復 2019-01-21
?
陪伴而非守候

TA貢獻1757條經驗 獲得超8個贊

你看上面我的回復

查看完整回答
反對 回復 2019-01-21
  • 8 回答
  • 0 關注
  • 1512 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號