WPF - STA requirement vs server-side usage
I am trying to use WPF objects (Drawing
, Geometry
, DrawingVisual
, etc) to create random icons for users on the server side of my web site.
When trying to do so in a request processing thread I get an exception "The calling thread must be STA because many UI components require this
".
Does this message开发者_高级运维 mean that WPF is mostly targeting single-threaded client-side UI? Is this the right choice then for me to use WPF on the server side? If yes, how to make a workaround for STA exception?
Look there - not directly answering your question, but there is working samples http://weblogs.asp.net/bleroy/archive/2009/12/10/resizing-images-from-the-server-using-wpf-wic-instead-of-gdi.aspx.
Yes WPF is targeted for client side ui or desktop application, check silverlight that is a web version and it can solve your problem as well.
精彩评论