我的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”。

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

解决方案 »

  1.   

    设置memoryLimit
    检查生成验证码方法
      

  2.   

    楼上的设置memoryLimit什么意思
      

  3.   

    memoryLimit不用设置的,如果代码有问题可在.net环境就可以显示出来
      

  4.   

    看看IIS应用程序池里对内存的限制状况
      

  5.   

    验证码程序如下
    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;
        }
    }