什么是一个会话变量可以容纳的最大尺寸是多少? [英] What is the maximum size a session variable can hold?

查看:207
本文介绍了什么是一个会话变量可以容纳的最大尺寸是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是会话变量可以容纳的最大尺寸是多少?我试图存储对象的会话变量,如果对象的大小是根据80 KB,则做工精细,如果大小大于80 KB然后retereival我收到例外。

What is the maximum size a session variable can hold ? I am trying to store object in session variable, if object size is under 80 KB, then working fine and if the size is greater than 80 KB then on retereival I am getting exception.

我怎么能增加会话变量的大小?

How can I increase the session variable size?

这行为是我的生产服务器上,在研究与开发的机器上,我可以储存像上面500 KB等大型物体。

This behaviour is on my production server, on the developement machine I can store big objects like above 500 KB etc..

我采取类似... http://aspalliance.com/1221_$c$cSnip_Uploading_Multiple_Files_At_Once.all

这是我的code ..

here is my code..

private static int count = 0;
protected void Upload_Click(object sender, EventArgs e)
{
    for (int loopCount = 0; loopCount < count; loopCount++)
    {
        HtmlInputFile hif = (HtmlInputFile)Session["myupload" + loopCount];
        String filePath = Server.MapPath("~/AdvImages/") + loopCount.ToString() + "_" + hif.PostedFile.FileName;
        hif.PostedFile.SaveAs(filePath);
        Session.Abandon();
    }
}
protected void btnAdd_Click1(object sender, EventArgs e)
{
    Session["myupload" + count] = FileUpload1;
    count++;
}

感谢

推荐答案

尝试requestLengthDiskThreshold改成这样:

Try to change requestLengthDiskThreshold to this:

<system.web>
    <httpRuntime executionTimeout="90" 
                 maxRequestLength="20000" 
                 useFullyQualifiedRedirectUrl="false" 
                 requestLengthDiskThreshold="8192"/>
</system.web>

谷歌搜索说,这有助于:

Googling says this helps:

http://www.netnewsgroups.net/group/microsoft.public.dotnet.framework.aspnet/topic32900.aspx
http://channel9.msdn.com/forums/TechOff/104616-ASPNet-20-Uploading-file-exception/

这篇关于什么是一个会话变量可以容纳的最大尺寸是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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