【发布时间】:2014-07-18 07:07:22
【问题描述】:
错误:当应用程序未在 UserInteractive 模式下运行时显示模式对话框或表单不是有效操作。指定 ServiceNotification 或 DefaultDesktopOnly 样式以显示来自服务应用程序的通知。
我看到这个错误已经在 StackOverflow 和其他网站上发布了很多。 但他们都想在他们的服务中显示 MessageBox 或 DialogBox。
我还没有编写任何代码行来在我的 WCF 服务中显示表单或消息框。
我还看到有人说这个错误可能是因为您的服务中发生了内部错误,并且因为它想显示错误消息,所以您会收到这个错误。我认为这在我的情况下更有可能,因为我在自己的计算机(即 Windows 7)中托管了我的 WCF 服务,没有任何问题。它工作正常。但是,当我在具有完全相同配置的生产环境(即 Windows Server 2008)中托管服务时,出现此错误。
如何查看我的服务中的问题?想要显示的对话框是什么?
更新:
服务器堆栈跟踪:在 System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(消息 回复、MessageFault 故障、字符串操作、MessageVersion 版本、 故障转换器故障转换器)在 System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime 操作,ProxyRpc& rpc) 在 System.ServiceModel.Channels.ServiceChannel.Call(字符串动作, Boolean oneway, ProxyOperationRuntime 操作, Object[] ins, Object[] 出局,TimeSpan 超时)在 System.ServiceModel.Channels.ServiceChannel.Call(字符串动作, Boolean oneway, ProxyOperationRuntime 操作, Object[] ins, 对象 [] 出局)在 System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall,ProxyOperationRuntime 操作)在 System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage 留言)
在 [0] 处重新抛出异常:在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg)在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(消息数据& msgData,Int32 类型)在 Khorramshahr_Ins.FingerPrintWebService.IIdentifyFingerPrint.IdentifyFinger(IdentifyFingerRequest 请求)在 Khorramshahr_Ins.FingerPrintWebService.IdentifyFingerPrintClient.IdentifyFinger(IdentifyFingerRequest 请求)在 C:\PROJECTS\Production V1.0\ImportExport\Production V1\Fermat.ImportExport.Presentation\Service References\FingerPrintWebService\Reference.vb:第 328 行,位于 Khorramshahr_Ins.frmDeliverDocuments.Callback(IAsyncResult ar) 在 C:\PROJECTS\Production V1.0\ImportExport\Production V1\Fermat.ImportExport.Presentation\Operator\frmDeliverDocuments.vb:line 63 在 Khorramshahr_Ins.frmDeliverDocuments.btnVerify_Click(对象 发件人,EventArgs e) 在 C:\PROJECTS\Production V1.0\ImportExport\生产 V1\Fermat.ImportExport.Presentation\Operator\frmDeliverDocuments.vb:line 47 在 System.Windows.Forms.Control.OnClick(EventArgs e) 在 System.Windows.Forms.Button.OnClick(EventArgs e) 在 System.Windows.Forms.ButtonBase.OnKeyUp(KeyEventArgs kevent) 在 System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m) 在 System.Windows.Forms.Control.ProcessKeyMessage(Message& m) 在 System.Windows.Forms.Control.WmKeyChar(Message& m) 在 System.Windows.Forms.Control.WndProc(Message& m) 在 System.Windows.Forms.ButtonBase.WndProc(Message& m) 在 System.Windows.Forms.Button.WndProc(Message& m) 在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(消息& m) 在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(消息& m) 在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) 在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(味精和味精)
在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID,Int32 原因,Int32 pvLoopData)在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 原因,ApplicationContext 上下文)在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 原因,ApplicationContext 上下文)在 System.Windows.Forms.Application.RunDialog(Form form) 在 System.Windows.Forms.Form.ShowDialog(IWin32Window 所有者)在 System.Windows.Forms.Form.ShowDialog() 在 Khorramshahr_Ins.TotalListWindow.btnDeliverDocuments_OnClick(对象 发件人,EventArgs e) 在 C:\PROJECTS\Production V1.0\ImportExport\生产 V1\Fermat.ImportExport.Presentation\Report\TotalListWindow.xaml.vb:line 185 在 System.Windows.Forms.Control.OnClick(EventArgs e) 在 System.Windows.Forms.Button.OnClick(EventArgs e) 在 增强型GlassButton.GlassButton.OnClick(EventArgs e) 在 System.Windows.Forms.Button.OnMouseUp(MouseEventArgs 事件) 在 增强型GlassButton.GlassButton.OnMouseUp(MouseEventArgs e) 在 System.Windows.Forms.Control.WmMouseUp(消息和 m,鼠标按钮 按钮,Int32 点击)在 System.Windows.Forms.Control.WndProc(Message& m) 在 System.Windows.Forms.ButtonBase.WndProc(Message& m) 在 System.Windows.Forms.Button.WndProc(Message& m) 在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(消息& m) 在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(消息& m) 在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) 在 MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) 在 System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame 帧)在 System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame 框架)
在 System.Windows.Window.ShowHelper(Object booleanBox) 在 System.Windows.Window.Show() 在 System.Windows.Window.ShowDialog()
【问题讨论】:
-
IdentifyFinger(...) 方法肯定会打开一个对话框,要求用户将手指放在某个传感器上。您是否在 Windows 7 机器上的 IIS 中托管了相同的服务?
-
不!正如我所说,它没有打开任何对话框。是的,它可以在我自己的 Windows 7 机器的 IIS 上运行
-
可能是不同的指纹硬件或驱动程序?
-
手指/加密狗的驱动程序/自制包装可能会显示一些对话框,因为加密狗显然是为桌面应用程序设计的。您可能需要检查调用堆栈或将其发布在此处,以便我们可能找到解决方案/解决方法以捕获错误,而无需让加密狗驱动程序显示对话框。更糟糕的情况是您可能不得不寻找另一个不那么粗鲁的加密狗。
-
@AndyH 它没有加密狗。它只有一个许可证文件,我也安装了它。我添加了堆栈跟踪