Using COM Objects from Within ASP.NET C# Help

COM objects can be used in a similar way to what you have seen before from within ASP.NET.

However, there is one important distinction. The ASP.NET runtune by default runs in an MTA. If the COM object is configured with the threading model value Apartment (as all COM objects that have been written with Visual Basic 6.0 are), an exception is thrown.

For performance and scalability reasons, it is best to avoid SfA objects within KP.NET.

If you really want to US(: an STA object with ASP.NET, you can set the AspCompat attribute with the Page directive as showr. in the following snippet. Be aware that the web site performance might suffer when you are usmg th option:

<%@ Page AspCompat=’true’ Language=’C.’ %>

Using STA COM objects with ASP.NET can lead to scalability problems.

It’s beat to avoid Uling STA COM objects with ASP.NET

Posted on October 27, 2015 in Interoperability

Share the Story

Back to Top