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. Exception Details: System.OutOfMemoryException: Out of memory.Source Error: 
Line 68:     {
Line 69:         string filePath = upFile.PostedFile.FileName;
Line 70:         System.Drawing.Image img = System.Drawing.Image.FromFile(filePath);
Line 71:         int iWidth = img.Width;     //图片宽
Line 72:         int iHeight = img.Height;   //图片高filePath 中显示的值是正确的,我把该值直接输在地址栏中显示图片正常.
但是不明白为什么会提示: Out of memory  ?
我又没有用数组什么的.还有就是如果图片放在我的文档什么的里面,那地址中有几个单词,同时有空格,就会有错误,如下:
c:\Documents and Settings\kgdiwss
这个Documents and Settings就是两个单词还有空格,会引起找不到图片.怎么解决?

解决方案 »

  1.   

    图片要放你的 iis下,不要放桌面上。
      

  2.   

    你的程序别人访问会有问题的Line 69:         string filePath = upFile.PostedFile.FileName;
    Line 70:         System.Drawing.Image img = System.Drawing.Image.FromFile(filePath);PostedFile.FileName获得的是客户端的文件路径
    用FromFile(...) 取不到,会出错
    当然你自己locahost测试的时候 既是服务器 又是客户端 不会有问题了
    如果放到服务器上 就错了。