C# GDI+;中发生一般性错误;厄洛尔

C# GDI+;中发生一般性错误;厄洛尔,c#,C#,首先,我要更换 ImagePath\u DevSvr=D:\Image.jpeg ImagePath\u DevSvr\u tif=E:\images\1.tif System.Drawing.Bitmap wiImage1 = null; string ReplaceImage_path1 = System.Configuration.ConfigurationManager.AppSettings["ImagePath_DevSvr_tif"]; wiIma

首先,我要更换 ImagePath\u DevSvr=D:\Image.jpeg ImagePath\u DevSvr\u tif=E:\images\1.tif

       System.Drawing.Bitmap wiImage1 = null;

   string ReplaceImage_path1 = System.Configuration.ConfigurationManager.AppSettings["ImagePath_DevSvr_tif"];

     wiImage1 = new System.Drawing.Bitmap(System.Configuration.ConfigurationManager.AppSettings["ImagePath_DevSvr"]);

      wiImage1.Save(ReplaceImage_path1);
        System.Drawing.Bitmap wiImage = null;

       string ReplaceImage_path = System.Configuration.ConfigurationManager.AppSettings["ImagePath_TestSvr_tif"];

      wiImage = new   System.Drawing.Bitmap(System.Configuration.ConfigurationManager.AppSettings["ImagePath_TestSvr"]);

       wiImage.Save(ReplaceImage_path);
第二,我正在替换 ImagePath_TestSvr=D:\Image.jpeg ImagePath_TestSvr_tif=F:\images\1.tif

       System.Drawing.Bitmap wiImage1 = null;

   string ReplaceImage_path1 = System.Configuration.ConfigurationManager.AppSettings["ImagePath_DevSvr_tif"];

     wiImage1 = new System.Drawing.Bitmap(System.Configuration.ConfigurationManager.AppSettings["ImagePath_DevSvr"]);

      wiImage1.Save(ReplaceImage_path1);
        System.Drawing.Bitmap wiImage = null;

       string ReplaceImage_path = System.Configuration.ConfigurationManager.AppSettings["ImagePath_TestSvr_tif"];

      wiImage = new   System.Drawing.Bitmap(System.Configuration.ConfigurationManager.AppSettings["ImagePath_TestSvr"]);

       wiImage.Save(ReplaceImage_path);

第一次更换它工作第二次它不工作请帮助我,提前谢谢

使用
Image.FromFile

Bitmap wiImage = (Bitmap) Image.FromFile(System.Configuration.ConfigurationManager.AppSettings["ImagePath"]);

它现在起作用的原因

  • Images\Image.jpg不存在,然后您创建/保存了它
  • 您从未保存具有应用程序设置的app.config文件

您是否处理位图?。您的应用程序是否有权写入
C:\Images
路径?wiImage=new System.Drawing.bitmap在此行出错是的,我的应用程序有权再次帮助我,我得到异常System.Drawing.bitmap wiImage=null;第二次你会得到什么例外?