Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
WPF中的WSDualHttpBinding没有响应_Wpf_Wcf_Wsdualhttpbinding_Servicebehavior_Instancecontextmode - Fatal编程技术网

WPF中的WSDualHttpBinding没有响应

WPF中的WSDualHttpBinding没有响应,wpf,wcf,wsdualhttpbinding,servicebehavior,instancecontextmode,Wpf,Wcf,Wsdualhttpbinding,Servicebehavior,Instancecontextmode,我在WPF应用程序中仅使用WCF WSDualHttpBinding时遇到问题。在更改之前,此WCF工作正常。现在不行了。我仅将ServiceBehavior(ConcurrencyMode和InstanceContextMode)更改为: 之后,WCF没有响应,请参阅异常详细信息。有什么想法吗 System.Reflection.TargetInvocationException was unhandled by user code HResult=-2146232828 Messag

我在WPF应用程序中仅使用WCF WSDualHttpBinding时遇到问题。在更改之前,此WCF工作正常。现在不行了。我仅将ServiceBehavior(ConcurrencyMode和InstanceContextMode)更改为:

之后,WCF没有响应,请参阅异常详细信息。有什么想法吗

System.Reflection.TargetInvocationException was unhandled by user code
  HResult=-2146232828
  Message=An exception occurred during the operation, making the result invalid.  Check InnerException for exception details.
  Source=System
  StackTrace:
       at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
       at MainModuleTracking.GXService.GetServerItemsCompletedEventArgs.get_Result() in d:\Projects\!New!\GXClient\MainModuleTracking.Desktop\Service References\GXService\Reference.cs:line 6274
       at Main.ViewModels.LogOnWindowViewModel.BaseFW_OnGetServerItemsCompleted(Object sender, GetServerItemsCompletedEventArgs e) in d:\Projects\!New!\GXClient\Main.Silverlight\ViewModels\LogOnWindowViewModel.cs:line 208
       at MainModuleTracking.GXService.MainServiceClient.OnGetServerItemsCompleted(Object state) in d:\Projects\!New!\GXClient\MainModuleTracking.Desktop\Service References\GXService\Reference.cs:line 8818
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.DispatcherOperation.InvokeImpl()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Windows.Threading.DispatcherOperation.Invoke()
       at System.Windows.Threading.Dispatcher.ProcessQueue()
       at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       at System.Windows.Window.ShowHelper(Object booleanBox)
       at System.Windows.Window.ShowDialog()
  InnerException: System.TimeoutException
       HResult=-2146233083
       Message=Opening the http://192.168.7.104:8181/WpfMainService channel timed out after 00:01:00. The time allotted to this operation may have been a portion of a longer timeout.
       Source=mscorlib
       StackTrace:
         Server stack trace:
            at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
            at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
            at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
            at System.ServiceModel.Channels.ServiceChannelProxy.InvokeEndService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
            at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
         Exception rethrown at [0]:
            at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
            at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
            at MainModuleTracking.GXService.IMainService.EndGetServerItems(IAsyncResult result)
            at MainModuleTracking.GXService.MainServiceClient.EndGetServerItems(IAsyncResult result) in d:\Projects\!New!\GXClient\MainModuleTracking.Desktop\Service References\GXService\Reference.cs:line 8802
            at MainModuleTracking.GXService.MainServiceClient.OnEndGetServerItems(IAsyncResult result) in d:\Projects\!New!\GXClient\MainModuleTracking.Desktop\Service References\GXService\Reference.cs:line 8810
            at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)
       InnerException: 
编辑

callbackService = new ServiceCallback();
InstanceContext context = new InstanceContext(callbackService);
mainService = new MainServiceClient(context, "WSDualHttpBinding_IMainService");
mainService.SubscribeErrorsAsync();
mainService.GetServerItemsAsync();

您的WCF呼叫似乎超时,因为您已将WCF服务器(基本上)设置为单次访问。如果您同时有多个对服务的调用,您的WCF服务将一次处理一个调用,并且您的超时非常短,因此其中一些调用会超时也就不足为奇了


您能解释一下为什么要更改并发模式吗?

我不知道如何更改,但问题在一段时间后得到了解决。我认为问题在于缺少更新。
现在,我试着在VS2013中使用,并且在构建后工作得很好(没有VS2013)。

我更改了Concurrencymode,因为我需要为每个客户机使用一个实例一个会话。我试图同时调试这两个(客户端和WCF)。在客户端上,在客户端调用一个方法后创建WCF实例。这个方法使异常-WCF没有响应。好的,我制作了一个小应用程序来说明这个问题。应用程序在这里处于默认工作状态。如果将clientBaseAddres更改为本地地址(如192.168.1.1),应用程序将停止工作。那么问题出在哪里呢?
callbackService = new ServiceCallback();
InstanceContext context = new InstanceContext(callbackService);
mainService = new MainServiceClient(context, "WSDualHttpBinding_IMainService");
mainService.SubscribeErrorsAsync();
mainService.GetServerItemsAsync();