Scott Hanselman

ASP.NET WebServices calling Apartment-Threaded COM Components...

July 17, 2003 Comment on this post [1] Posted in Web Services | ASP.NET | XML | Tools
Sponsored By

If you've ever had to call a VB6 Component from an ASP.NET (ASMX) XML Web Service, you may (most probably) get threading errors.  In ASP.NET Apps you can mark the Page directive with "ASPCompat='true'" but there is not a equivalent tag for Web Services.  So, there's a few things you can do:
  • Put the VB Component in COM+ (Preferred if the COM Object is part of a larger interaction, and you want fine control over your SOAP)
  • Figure out a different way to expose the COM Object as a Web Service, perhaps with Classic ASP and SOAP Toolkit 3.0 (Quick if you just want to get your component, but has larger design ramifications for big systems)
 

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
July 18, 2003 7:10
Hey Scott...presumably you could reflect on the VB COM object and use the code DOM to generate a dynamic assembly that would expose the same interface. Then you could write a delegating wrapper class that created a thread, created the VB COM component on the thread, expose the original interface, and then forwarded all calls on the thread so that apartment model would work ... right? ;-) Well, yeah, by the time you got this all working it would be easier to just rewrite the COM component, but think how much fun it would be!

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.