关于内存不足问题 在线等候

zhaocbo2003 2010-10-10 09:39:18
我的asp.net项目里用户登录需要输入验证码,在.net 环境下是可以显示出来的,而放到IIS环境侧显示不出来,提示内存不足,在网上找了些资料如下
IIS上的站点可以绑定在不同的端口,例如80,81,82,83等不同端口。当创建了5个占用不同端口的站点后,再创建第六个端口时候,IIS会报告“无更多可用内存”。

  解决方案
  这是微软IIS的设计造成的。要想添加第六个不同端口的站点,需要修改注册表:

  1、打开注册表编辑器,开始-运行-输入“regedit”;
  2、展开HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\HTTP\Parameters\;
  3、在其下创建一个DWORD值类型的键值,命名为MaxEndpoints,值为十六进制的0;
  4、重新启动IIS,开始-运行-cmd,输入“net stop http”,然后“net start http”。

我试了不是这个问题,补充一下其它页面都可以正常显示就是验证码那里显示不出来,在线等候高手指点

...全文
168 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
加油馒头 2010-10-11
  • 打赏
  • 举报
回复
服务器问题 可能不大
zhaocbo2003 2010-10-10
  • 打赏
  • 举报
回复
网上找当然是可以的,我主要想知道是那会事,是代码问题还是服务器问题
孟子E章 2010-10-10
  • 打赏
  • 举报
回复
真正的服务器不会有5个站点的限制的

另外,你到网上找另外一个验证码代码测试看是否有此问题
zhaocbo2003 2010-10-10
  • 打赏
  • 举报
回复
验证码程序如下
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
//using System.Web.UI.WebControls;
//using System.Web.UI.WebControls.WebParts;
//using System.Web.UI.HtmlControls;

using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Drawing2D;


public partial class Admin_Show_VerifyCode : BasePage
{
protected void Page_Load(object sender, EventArgs e)
{
if (!this.Page.IsPostBack)
{
try
{
Image image = Image.FromFile(base.Server.MapPath("../Admin/images/VerifyCodeBack.Gif"));
int width = image.Width;
int height = image.Height;

string text = RndNum() ;// this.Session[configInfo.CachePre + "ImageCode"].ToString();
Bitmap bitmap = new Bitmap(width, height, PixelFormat.Format24bppRgb);
bitmap.SetResolution(85f, 72f);
Graphics graphics = Graphics.FromImage(bitmap);
graphics.Clear(Color.White);
graphics.SmoothingMode = SmoothingMode.AntiAlias;
graphics.DrawImage(image, new Rectangle(0, 0, width, height), 0, 0, width, height, GraphicsUnit.Pixel);
int[] numArray = new int[] { 0x10, 14, 12, 10, 8, 6, 4 };
Font font = null;
// SizeF ef = new SizeF();
for (int i = 0; i < 0x10; i++)
{
font = new Font("Arial", (float)numArray[i], FontStyle.Bold);
if (((ushort)graphics.MeasureString(text, font).Width) < ((ushort)width))
{
break;
}
}
float num4 = height / 2;
float num5 = width / 2;
StringFormat format = new StringFormat();
format.Alignment = StringAlignment.Center;
format.LineAlignment = StringAlignment.Center;
graphics.DrawString(text, font, new SolidBrush(Color.Black), new PointF(num5 + 1f, num4 + 1f), format);
base.Response.ContentType = "image/jpeg";
bitmap.Save(base.Response.OutputStream, ImageFormat.Jpeg);
}
catch (Exception exception)
{
base.Response.Write(exception.Message);
}
}
}

private string RndNum()
{
string[] textArray = new string[] {
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f",
"g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v",
"w", "x", "y", "z"
};

string text = "";
Random random = new Random();
for (int i = 0; i < 4; i++)
{
text = text + textArray[random.Next(0, textArray.Length)].ToString() + " ";
}
Session[configInfo.CachePre + "ImageCode"] = text.Replace(" ", "");
Session[configInfo.CachePre + "VerifyCode"] = text.Replace(" ", "");
return text;
}


}
zhubo_1117 2010-10-10
  • 打赏
  • 举报
回复
估计是你的验证码程序有问题
phil999 2010-10-10
  • 打赏
  • 举报
回复
看看IIS应用程序池里对内存的限制状况
罗纳尔迪尼奥 2010-10-10
  • 打赏
  • 举报
回复
重新再网上找个验证码生成的程序
zhaocbo2003 2010-10-10
  • 打赏
  • 举报
回复
memoryLimit不用设置的,如果代码有问题可在.net环境就可以显示出来
zhaocbo2003 2010-10-10
  • 打赏
  • 举报
回复
楼上的设置memoryLimit什么意思
zhaocbo2003 2010-10-10
  • 打赏
  • 举报
回复
这怎么就没人来回答啊,是不是都不明白啊,难道找一个高手这么难啊!
wuyq11 2010-10-10
  • 打赏
  • 举报
回复
设置memoryLimit
检查生成验证码方法
zhaocbo2003 2010-10-10
  • 打赏
  • 举报
回复
高手都去那了,自己先顶一下

62,271

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧