all groups > dotnet web services > march 2006 >
You're in the

dotnet web services

group:

Using server-side OCX control with ASP.Net Web Service


Using server-side OCX control with ASP.Net Web Service las NO[at]SPAM labapps.com
3/31/2006 9:48:08 AM
dotnet web services:
(Originally posted to framework.aspnet.webservices, but I am casting a
larger net and trying again)

I am using a library supplied by a third-party vendor. Although the
library has no UI, the vendor supplies it as an .OCX control.

I need to utilize this library in an ASP.Net Web Service. My Web
Service does not expose the OCX control's functionality directly, but
utilizes the OCX for its own internal purposes.

What is the best approach here?

Since I am more familiar with old VB6 than with .Net, I was thinking of
wrapping the OCX with an ActiveX server written in VB6. This ActiveX
server would provide the hidden form that the OCX requires. I would
then utilize the ActiveX server from ASP.Net via interop.

Does this make sense? How would I do this using just .Net -- without
getting VB6 involved?

TIA!
Lee
Re: Using server-side OCX control with ASP.Net Web Service Bruce Barker
3/31/2006 10:08:33 AM
you have a couple issues. asp.net webservices do not support sta com objects
(like ones built in vb6). you should host then in com+, or create your own
sta thread that manages calls to the ocx.

-- bruce (sqlwork.com)




[quoted text, click to view]

Re: Using server-side OCX control with ASP.Net Web Service sirfunusa
3/31/2006 10:55:30 AM
Don't use VB6! Just add a reference to this OCX. In solution explorer,
right click "References" and add it.

Wait, the control requires a form?? In a web service? Won't work.
Re: Using server-side OCX control with ASP.Net Web Service las NO[at]SPAM labapps.com
3/31/2006 11:10:44 AM
Thanks for the heads-up on STA! I had threading in the back of my mind
but had not yet gotten around to researching it -- maybe I was just
afraid of what I would find <grin>
Re: Using server-side OCX control with ASP.Net Web Service las NO[at]SPAM labapps.com
3/31/2006 2:06:12 PM
Bruce,

Reviewing the @Page directive, it looks like it can only be used on ASP
Web Forms.

Can aspcompat be set for a web service, or is there something
comparable for a web service?

Thanks,
Lee
Re: Using server-side OCX control with ASP.Net Web Service las NO[at]SPAM labapps.com
3/31/2006 2:08:17 PM
Sorry, I meant to address that last question to Willy.
Re: Using server-side OCX control with ASP.Net Web Service Willy Denoyette [MVP]
3/31/2006 10:10:17 PM
Sure it does, all you have to do is set the "aspcomp" attribute to true at
the page level.

Willy.

[quoted text, click to view]
| you have a couple issues. asp.net webservices do not support sta com
objects
| (like ones built in vb6). you should host then in com+, or create your own
| sta thread that manages calls to the ocx.
|
| -- bruce (sqlwork.com)
|
|
|
|
[quoted text, click to view]
| > (Originally posted to framework.aspnet.webservices, but I am casting a
| > larger net and trying again)
| >
| > I am using a library supplied by a third-party vendor. Although the
| > library has no UI, the vendor supplies it as an .OCX control.
| >
| > I need to utilize this library in an ASP.Net Web Service. My Web
| > Service does not expose the OCX control's functionality directly, but
| > utilizes the OCX for its own internal purposes.
| >
| > What is the best approach here?
| >
| > Since I am more familiar with old VB6 than with .Net, I was thinking of
| > wrapping the OCX with an ActiveX server written in VB6. This ActiveX
| > server would provide the hidden form that the OCX requires. I would
| > then utilize the ActiveX server from ASP.Net via interop.
| >
| > Does this make sense? How would I do this using just .Net -- without
| > getting VB6 involved?
| >
| > TIA!
| > Lee
| >
|
|

Re: Using server-side OCX control with ASP.Net Web Service Willy Denoyette [MVP]
4/1/2006 10:07:07 PM

[quoted text, click to view]
| Bruce,
|
| Reviewing the @Page directive, it looks like it can only be used on ASP
| Web Forms.
|
| Can aspcompat be set for a web service, or is there something
| comparable for a web service?
|
| Thanks,
| Lee
|

You are right, it only applies to web application not web services. Web
services cannot handle STA threads nor should you ever try to run OCX
components in web applications at all, there isn't such a thing like server
type OCX's , even if they don't have an UI, they have at least one hidden
window and this window's message queue need to be pumped and dispached.
Nothing in the web framework will do this for you, this result in high
memory consumption leading to process recyling and possible deadlocks.


Willy.

Re: Using server-side OCX control with ASP.Net Web Service las NO[at]SPAM labapps.com
4/3/2006 10:52:40 AM

I just got a communication from the vendor -- it seems their OCX can be
instantiated without a hidden window.

That good news solves the hidden window nastiness described by Willy,
but I guess I still must resolve the STA issue.

I've got some custom connection pooling issues to deal with too, so
I'll probably bundle the STA and connection pooling solutions together.
Looking into COM+ now, but I may just fall back on my old-school roots
and create an out-of-process activeX server.

Thanks Bruce and Willy for your feedback,
Lee
AddThis Social Bookmark Button