I have a windows application that communicates with a web services. The win app, synchronizes the data, and along with data, there may be images that get synched. The process
works great if I run both win app and web services locally, but when the win app connects to the web services on the remote server, the image sync process comes back with the A generic error occurred in GDI+ error. I tried to track the problem by changing
the directory permissions, but nothing seem to work. The directory that supposed to hold the images is defined in web.config if that matters. The problem doesn't seem to be the code since it works locally. the directory on the remote server has write permission
for Network Service,ASP.NET, and IISUser as well. Not sure what else to look for. Any idea?
here is the code:
MemoryStream memoryStream = new MemoryStream(image.ImageData.ToArray());
Image img = Image.FromStream(memoryStream);
img.Save(imgPath); <-- Error occurs here
img.Dispose();
memoryStream.Close();
I would double check the permissions on the folder, as well as the account the site is running under. The account will also need modify permissions on the folder.
"Sometimes, it is more important to have the right problem than the best solution."
None
0 Points
3 Posts
A generic error occurred in GDI+.
Jun 27, 2011 02:29 PM|simpleweb2|LINK
Hi there,
I have a windows application that communicates with a web services. The win app, synchronizes the data, and along with data, there may be images that get synched. The process works great if I run both win app and web services locally, but when the win app connects to the web services on the remote server, the image sync process comes back with the A generic error occurred in GDI+ error. I tried to track the problem by changing the directory permissions, but nothing seem to work. The directory that supposed to hold the images is defined in web.config if that matters. The problem doesn't seem to be the code since it works locally. the directory on the remote server has write permission for Network Service,ASP.NET, and IISUser as well. Not sure what else to look for. Any idea?
here is the code:
MemoryStream memoryStream = new MemoryStream(image.ImageData.ToArray());
Image img = Image.FromStream(memoryStream);
img.Save(imgPath); <-- Error occurs here
img.Dispose();
memoryStream.Close();
Contributor
7304 Points
1672 Posts
Re: A generic error occurred in GDI+.
Jun 27, 2011 02:34 PM|tehremo|LINK
I would double check the permissions on the folder, as well as the account the site is running under. The account will also need modify permissions on the folder.
None
0 Points
3 Posts
Re: A generic error occurred in GDI+.
Jun 27, 2011 02:42 PM|simpleweb2|LINK
thanks for your reply. The site runs undder IUser, and it has write persmission on that folder. Any other suggestions?
None
0 Points
3 Posts
Re: A generic error occurred in GDI+.
Jun 27, 2011 02:53 PM|simpleweb2|LINK
found the problem. It was a typo in the directory path on the remote server. I fixed it and worked like a charm.