如何解决错误:显示一个模式对话框或窗体,当应用程序不在UserInteractive模式下运行是不是有效的操作 [英] How to resolve Error : Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation

查看:1571
本文介绍了如何解决错误:显示一个模式对话框或窗体,当应用程序不在UserInteractive模式下运行是不是有效的操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作项目。在当我运行它是很好的运行,但上传到当我检查我的域名后,那么它会显示如错误的项目我的系统:

I am working on project. In my System when I run the project it is running nicely, but after uploading it to my domain when I check, then it displays the error like:

显示模式对话框或窗体,当应用程序不在UserInteractive模式运行的是不是一个有效的操作。请指定ServiceNotification或DefaultDesktopOnly样式,以显示服务应用程序的通知。

"Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application."

说明:当前Web请求的执行过程中发生未处理的异常。请查看有关错误的详细信息的堆栈跟踪以及它起源于code。

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

异常详细信息信息:System.InvalidOperationException:显示模式对话框或当应用程序不在UserInteractive模式运行形成不是一个有效的操作。请指定ServiceNotification或DefaultDesktopOnly样式,以显示服务应用程序的通知。

Exception Details: System.InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.

什么是是这种情况的原因以及如何解决?

What is is the reason for this and how can I resolve it?

请帮我...

感谢。

推荐答案

此错误可以通过添加解决<一个href=\"http://msdn.microsoft.com/en-us/library/system.windows.forms.messageboxoptions%28v=vs.80%29.aspx\"><$c$c>MessageBoxOptions.ServiceNotification.

This error can be resolved by adding MessageBoxOptions.ServiceNotification.

MessageBox.Show(msg, "Print Error", System.Windows.Forms.MessageBoxButtons.YesNo, 
   System.Windows.Forms.MessageBoxIcon.Error,     
   System.Windows.Forms.MessageBoxDefaultButton.Button1, 
   System.Windows.Forms.MessageBoxOptions.ServiceNotification); 

但它不会显示任何对话框,如果你的web应用程序安装在IIS或server.Because在IIS或服务器是托管在工过程,不要有任何的桌面。

But it is not going to show any dialog box if your web application is installed on IIS or server.Because in IIS or server it is hosted on worker process which dont have any desktop.

这篇关于如何解决错误:显示一个模式对话框或窗体,当应用程序不在UserInteractive模式下运行是不是有效的操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆