bitmap.Save()的权限问题 [英] Permission problem with bitmap.Save()

查看:391
本文介绍了bitmap.Save()的权限问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个简单的代码:



System.Drawing.Bitmap bm = bitmapSourceToBitmap(source);
try
            {
                bm.Save(@"C:\Seva\testeImagem.jpg");
            }
            catch (Exception ex)
            {

            }

抛出:通用错误GDI +。
无论如何,我进行了搜索,人们说问题在于权限问题。我该如何授予它权限?谢谢

This throws: Generic Error GDI+. Anyway, I seached and people say that the problem is with permissions. How can I give permissions to it? Thanks

推荐答案

首先找出代码运行的凭据。

First find out under what credentials the code is running.

然后检查(并在需要时修复)Seva文件夹的安全性/ NTFS设置。

Then check (and, when needed, fix) the security/NTFS settings of the Seva folder.

特别是当此代码在网站或服务中运行时,该帐户将无权写入该文件夹。

Especially when this code is running from within a website or service the account will not have permissions to write to the folder.

这篇关于bitmap.Save()的权限问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆