1
안녕하세요 저는이 폴더의 inetpub \ wwwroot \ finder에 이미지를 저장할 웹 서비스를 만듭니다 ...이 경우에는 가상 디렉터리 .... 다음 오류가 발생합니다 ---SQL 서버에서 이미지를 저장하는 동안 C# 웹 서비스에서 GDI + 오류가 발생했습니다. r2
System.Runtime.InteropServices.ExternalException : GDI +에서 일반 오류가 발생했습니다. Service.add_product (문자열 addprod)
수 있도록 모두가 모든 권한을 내 찾기 폴더의 수 경우에도...
string img_base64;
[WebMethod]
public string add_product(string addprod)
{
String[] str_arr = addprod.Split('>');
city = str_arr[0];
cat = str_arr[1];
description = str_arr[2];
prod_pos = str_arr[3];
_mobile = str_arr[4];
img_base64 = str_arr[5];
lati = str_arr[6];
longi = str_arr[7];
land = str_arr[8];
Decimal latitu = Convert.ToDecimal(lati);
Decimal longit = Convert.ToDecimal(longi);
// Environment.CurrentDirectory();
// Environment.GetFolderPath("~");
string saveLocation = HttpContext.Current.Server.MapPath("~" +_mobile+ ".jpeg");
byte[] bytes = Convert.FromBase64String(img_base64);
Image image;
using (var ms = new MemoryStream(bytes))
{
image = Image.FromStream(ms);
image.Save(saveLocation, System.Drawing.Imaging.ImageFormat.Png);
}
String img_path = "http://Server IP/folder name/" + _mobile + ".png";
string sql = "insert into add_product (city,category,description,prod_pos,mobile,latitudeimage,longitude,landmark,image) values('" + city + "','" + cat + "','" + description + "','" + prod_pos + "','" + _mobile + "','" + latitu + "','" + longit + "','" + land + "','" + img_path + "')";
con.InsertData(sql);
return "Added Successfully";
}
에서 System.Drawing.Image.Save (문자열 파일 이름, ImageCodecInfo 인코더, EncoderParameters encoderParams) 에서
솔루션을 제안하십시오 .....
_mobile은 파일 이름 ..... "http : // 서버 IP/폴더 이름 /"+ _mobile + ".png" – user2964797