From reading some other threads in this forum, it seems that accessing PI-SDK from an MTA multi-threaded application can be very expensive for some calls (because PI-SDK is an STA object so there is cross-thread marshalling). So the recommendation when using C# (which uses the MTA model by default) is to use the [STAThread] attribute on the main/thread entry points.
However, if I am creating an ASP.Net Web service, IIS creates the threads (in a pool) and calls my Web methods inside them so I can't make the threads STA. This may lead to poor performance when calling PI-SDK - essentially serializing all SDK calls, so I can't use parallelism or async calls to improve performance.
For ASPX pages I read that you can put "AspCompat=true" in the Page directive of the markup file, which makes it use the STA threading model,but sadly an ASMX Web service only has the WebService directive which doesn't support this.
<%@ WebService Language="C#" CodeBehind="MyWS.asmx.cs" Class="MyWeb.MyWS" %>
Do you think the "hack" described in this article would help? Anyone know an easier way to use PI-SDK from a web service?