2016-01-13 93 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

相關問題