470,619 Members | 1,469 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,619 developers. It's quick & easy.

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

las
(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

Mar 31 '06 #1
8 2626
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)


<la*@labapps.com> wrote in message
news:11**********************@t31g2000cwb.googlegr oups.com...
(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

Mar 31 '06 #2
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.

Mar 31 '06 #3
las
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>

Mar 31 '06 #4
Sure it does, all you have to do is set the "aspcomp" attribute to true at
the page level.

Willy.

"Bruce Barker" <br******************@safeco.com> wrote in message
news:eP**************@tk2msftngp13.phx.gbl...
| 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)
|
|
|
|
| <la*@labapps.com> wrote in message
| news:11**********************@t31g2000cwb.googlegr oups.com...
| > (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
| >
|
|
Mar 31 '06 #5
las
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

Mar 31 '06 #6
las
Sorry, I meant to address that last question to Willy.

Mar 31 '06 #7

<la*@labapps.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
| 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.
Apr 1 '06 #8
las

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

Apr 3 '06 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Siddharth Jain | last post: by
8 posts views Thread by acb | last post: by
reply views Thread by Metal2You | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.