在Web应用程序中创建线程会导致IIS中的会话超时 [英] Creating thread in web aplication results in session time out in IIS

查看:85
本文介绍了在Web应用程序中创建线程会导致IIS中的会话超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



在我的asp.net应用程序中,我使用windows forms.dll通过创建一个线程来使用一些Windows控件。这很好用在我的系统中,但是当在IIS上托管时会给出会话超时。

创建一个线程让我在IIS上有会话超时。

我如何创建可以在IIS上正常工作的线程?



以下是iam创建线程的代码。



Hi All,

In my asp.net application, iam using windows forms.dll to use some of the windows controls by creating a thread.This works fine in my system but is giving a session timeout when hosted on IIS.
Creating a thread gives me session time out on IIS.
How do i create threads that can work fine on IIS?

Below is the code where iam created the thread.

public string[] DisplayFileDialog()
        {
            string[] result = null;

            try
            {
                Thread objThread = new Thread(state =>{
                    result = FnOpenFileDialog();
                    // TODO: do something with the returned result
                });

                objThread.IsBackground = false;
                objThread.SetApartmentState(ApartmentState.STA);
                objThread.Start();
                objThread.Join();
                return result;

            }
            catch (Exception ex)
            {

              
                return result;
            }

     protected string[] FnOpenFileDialog()
        {
            IntPtr hdlr = GetForegroundWindow();

            WindowWrapper Mockwindow = new WindowWrapper(hdlr);

            OpenFileDialog fDialog = new OpenFileDialog();

            fDialog.Title = "Select Files";

            fDialog.Multiselect = true;
            fDialog.CheckFileExists = true;
            fDialog.CheckPathExists = true;

            System.Windows.Forms.DialogResult dr = fDialog.ShowDialog(Mockwindow);
            string[] filenames = fDialog.FileNames;
            return filenames;
        }





提前致谢。



Thanks in advance.

推荐答案

您好,



尝试在浏览器中设置cookie并将cookie中的值分配给会话。



希望这个会帮你的。
Hi,

Try to set cookies in your browser and assign values from cookies to session.

Hope this will help you.


你好,





那是因为我的服务器是64位和窗体窗体处理器窗口是32位。

我不能在服务器上使用Windows窗体对象。

我用flajaxian uploader来解决我的问题。这让我可以即使在IE 7中也可以选择多个文件。
Hi ,


That was because my server is of 64 bit and windows forms handler window was of 32 bit.
I cannot use a windows forms object on the server.
I used flajaxian uploader to solve my problem.This allows me to select multiple files even in IE 7.


这篇关于在Web应用程序中创建线程会导致IIS中的会话超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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