2016-01-13 73 views
3

我正在为ASP.NET网站开发一些图像处理代码,最终将作为Web服务公开。这种不祥的“System.Drawing”警告是什么意思?

在System.Drawing命名空间文档的底部:

https://msdn.microsoft.com/en-us/library/system.drawing.aspx

是这个不祥的警告:

Classes within the System.Drawing namespace are not supported for use 
within a Windows or ASP.NET service. Attempting to use these classes from 
within one of these application types may produce unexpected problems, such 
as diminished service performance and run-time exceptions. For a supported 
alternative, see Windows Imaging Components. 

通过 “ASP.NET服务” 做他们的意思是Web服务?我不认为“Windows图像组件”是专门用来处理图像的。

System.Drawing命名空间是否可以安全地用于ASP.NET Web服务中的图像处理?

回答

2

该声明表示任何ASP.NET应用程序,包括WebForms,MVC,Web API和SignalR。

System.Drawing仅适用于在正常用户会话中运行的WinForms或控制台应用程序。

其他人可能会声称System.Drawing在那些不支持的方案中适用于他们,但根本不支持微软。

+0

圣牛,我绝对_no_ idea_。我们已经有了一些基于System.Drawing的代码,可以为我们已使用多年的上传图像生成缩略图。我可能需要重新考虑一下...... – n8wrl

+0

@ n8wrl然后你就这么幸运。一些硬件/软件可能只是愉快地运行它,但是在GitHub的corefx repo上正在讨论适合服务器场景的库。这方面可能会有些不错的东西。 –

+0

看起来像CoreFX可能是一个办法。你能推荐一个支持服务器端的库吗? – n8wrl

相关问题