private System.Drawing.Image GetImage(string path)
{
try
{
if (path.StartsWith("http"))
{
System.Net.WebRequest request = System.Net.WebRequest.Create(path);
request.Timeout = 10000;
System.Net.HttpWebResponse httpresponse = (System.Net.HttpWebResponse)request.GetResponse();
Stream s = httpresponse.GetResponseStream();
return System.Drawing.Image.FromStream(s);
}
else
{
return System.Drawing.Image.FromFile(path);
}
}
catch (Exception)
{
return null;
}
}
.net core 根据网络地址或者本地文件地址生成图片文件 本地测试没问题 发布到iis上之后 提示System.Drawing is not supported on this platform.
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
2条回答 默认 最新
- naruto2017 2020-04-28 04:33关注
可能是发布的程序中【System.Drawing.Common.dll】这个文件有问题
我的程序时基于.net core 2.2,发布时【System.Drawing.Common.dll】的大小为141KB,
在publish\runtimes\win\lib\netcoreapp2.0目录下有一个大小为659KB的,这个才是正常的。
将该dll拷贝替换网站目录下的同名文件即可解决。
解决 1无用
悬赏问题
- ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
- ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
- ¥20 有关区间dp的问题求解
- ¥15 多电路系统共用电源的串扰问题
- ¥15 slam rangenet++配置
- ¥15 有没有研究水声通信方面的帮我改俩matlab代码
- ¥15 ubuntu子系统密码忘记
- ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
- ¥15 保护模式-系统加载-段寄存器
- ¥15 电脑桌面设定一个区域禁止鼠标操作