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

Discussion in 'ASP .Net' started by las@labapps.com, Mar 31, 2006.

  1. Guest

    (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, 2006
    #1
    1. Advertising

  2. Bruce Barker Guest

    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)




    <> wrote in message
    news:...
    > (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
    >
    Bruce Barker, Mar 31, 2006
    #2
    1. Advertising

  3. sirfunusa Guest

    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.
    sirfunusa, Mar 31, 2006
    #3
  4. Guest

    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, 2006
    #4
  5. Sure it does, all you have to do is set the "aspcomp" attribute to true at
    the page level.

    Willy.

    "Bruce Barker" <> wrote in message
    news:...
    | 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)
    |
    |
    |
    |
    | <> wrote in message
    | news:...
    | > (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
    | >
    |
    |
    Willy Denoyette [MVP], Mar 31, 2006
    #5
  6. Guest

    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, 2006
    #6
  7. Guest

    Sorry, I meant to address that last question to Willy.
    , Mar 31, 2006
    #7
  8. <> wrote in message
    news:...
    | 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.
    Willy Denoyette [MVP], Apr 1, 2006
    #8
  9. Guest

    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, 2006
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. MarkD
    Replies:
    0
    Views:
    859
    MarkD
    Aug 3, 2005
  2. Replies:
    0
    Views:
    450
  3. Neal Bade
    Replies:
    2
    Views:
    619
    Neal Bade
    Nov 26, 2007
  4. Neal Bade
    Replies:
    0
    Views:
    343
    Neal Bade
    Nov 29, 2007
  5. Lee

    Using server-side OCX with ASP.Net Web Service

    Lee, Mar 30, 2006, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    210
Loading...

Share This Page