How to initalize COM from an ASP.NET

Discussion in 'ASP .Net' started by =?Utf-8?B?UE9uZnJp?=, Mar 16, 2005.

  1. I'm developing an ASP page for my group at work that manages MS virtual
    Server images. If i make a call to initalize com by using COInitializeEX and
    security ect.. I get a dreadful meassage stating that i need to do this
    before any marshalling ect.. are done.

    It does not seem to matter were i do this (Page_Load, OnInit). Now i did
    decide to not worrie about this and make the api calls i need to make inot
    virtual server and it works, BUT, now when i try to get a class object of a
    remote virtual server i'm getting an error and was wondering if its because i
    didnt initialize COM.

    So the question is. For web based apps (Web Services, ASP) do i have to
    initialize com? If so how do i do it so i dont get that error ?

    Thanks!
     
    =?Utf-8?B?UE9uZnJp?=, Mar 16, 2005
    #1
    1. Advertising

  2. =?Utf-8?B?UE9uZnJp?=

    Brock Allen Guest

    This isn't something you'd call from ASP.NET since you're being hosted in
    someone else's app (aspnet_wp.exe or w3wp.exe). My recollection is that you
    need to call CoInitSec to do certain things with the virtual server API,
    yes? This isn't really going to fly in ASP.NET, so you'll need to build a
    seperate Win32 process where you have control over the COM security model.
    This can be done from managed code, but my recollection is that there are
    some snaffus. So, you'll need to make this seperate process available via
    remoting or some other IPC mechanism to your ASP.NET code.

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen

    > I'm developing an ASP page for my group at work that manages MS
    > virtual Server images. If i make a call to initalize com by using
    > COInitializeEX and security ect.. I get a dreadful meassage stating
    > that i need to do this before any marshalling ect.. are done.
    >
    > It does not seem to matter were i do this (Page_Load, OnInit). Now i
    > did decide to not worrie about this and make the api calls i need to
    > make inot virtual server and it works, BUT, now when i try to get a
    > class object of a remote virtual server i'm getting an error and was
    > wondering if its because i didnt initialize COM.
    >
    > So the question is. For web based apps (Web Services, ASP) do i have
    > to initialize com? If so how do i do it so i dont get that error ?
    >
    > Thanks!
    >
     
    Brock Allen, Mar 16, 2005
    #2
    1. Advertising

  3. Thanks a bunch Brock,

    Guess its time to get a book or something and figure this out. I'm fairly
    new to alot of this stuff so learning as i go. If ya got any good reads
    please let me know.

    Thanks

    "Brock Allen" wrote:

    > This isn't something you'd call from ASP.NET since you're being hosted in
    > someone else's app (aspnet_wp.exe or w3wp.exe). My recollection is that you
    > need to call CoInitSec to do certain things with the virtual server API,
    > yes? This isn't really going to fly in ASP.NET, so you'll need to build a
    > seperate Win32 process where you have control over the COM security model.
    > This can be done from managed code, but my recollection is that there are
    > some snaffus. So, you'll need to make this seperate process available via
    > remoting or some other IPC mechanism to your ASP.NET code.
    >
    > -Brock
    > DevelopMentor
    > http://staff.develop.com/ballen
    >
    > > I'm developing an ASP page for my group at work that manages MS
    > > virtual Server images. If i make a call to initalize com by using
    > > COInitializeEX and security ect.. I get a dreadful meassage stating
    > > that i need to do this before any marshalling ect.. are done.
    > >
    > > It does not seem to matter were i do this (Page_Load, OnInit). Now i
    > > did decide to not worrie about this and make the api calls i need to
    > > make inot virtual server and it works, BUT, now when i try to get a
    > > class object of a remote virtual server i'm getting an error and was
    > > wondering if its because i didnt initialize COM.
    > >
    > > So the question is. For web based apps (Web Services, ASP) do i have
    > > to initialize com? If so how do i do it so i dont get that error ?
    > >
    > > Thanks!
    > >

    >
    >
    >
    >
     
    =?Utf-8?B?UE9uZnJp?=, Mar 16, 2005
    #3
  4. =?Utf-8?B?UE9uZnJp?=

    Brock Allen Guest

    Oh gosh -- you're learning .NET *and* COM at the same time? That's quite
    an endeavor. As for the best COM/.NET interop guide, check out ".NET and
    COM The Complete Interoperability Guide" by Nathan.

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen



    > Thanks a bunch Brock,
    >
    > Guess its time to get a book or something and figure this out. I'm
    > fairly new to alot of this stuff so learning as i go. If ya got any
    > good reads please let me know.
    >
    > Thanks
    >
    > "Brock Allen" wrote:
    >
    >> This isn't something you'd call from ASP.NET since you're being
    >> hosted in someone else's app (aspnet_wp.exe or w3wp.exe). My
    >> recollection is that you need to call CoInitSec to do certain things
    >> with the virtual server API, yes? This isn't really going to fly in
    >> ASP.NET, so you'll need to build a seperate Win32 process where you
    >> have control over the COM security model. This can be done from
    >> managed code, but my recollection is that there are some snaffus. So,
    >> you'll need to make this seperate process available via remoting or
    >> some other IPC mechanism to your ASP.NET code.
    >>
    >> -Brock
    >> DevelopMentor
    >> http://staff.develop.com/ballen
    >>> I'm developing an ASP page for my group at work that manages MS
    >>> virtual Server images. If i make a call to initalize com by using
    >>> COInitializeEX and security ect.. I get a dreadful meassage stating
    >>> that i need to do this before any marshalling ect.. are done.
    >>>
    >>> It does not seem to matter were i do this (Page_Load, OnInit). Now i
    >>> did decide to not worrie about this and make the api calls i need to
    >>> make inot virtual server and it works, BUT, now when i try to get a
    >>> class object of a remote virtual server i'm getting an error and was
    >>> wondering if its because i didnt initialize COM.
    >>>
    >>> So the question is. For web based apps (Web Services, ASP) do i have
    >>> to initialize com? If so how do i do it so i dont get that error ?
    >>>
    >>> Thanks!
    >>>
     
    Brock Allen, Mar 16, 2005
    #4
  5. HeHe, yeah very painful but its been a great experiance. Thanks a bunch for
    the tip ont he book. I will check it out.

    "Brock Allen" wrote:

    > Oh gosh -- you're learning .NET *and* COM at the same time? That's quite
    > an endeavor. As for the best COM/.NET interop guide, check out ".NET and
    > COM The Complete Interoperability Guide" by Nathan.
    >
    > -Brock
    > DevelopMentor
    > http://staff.develop.com/ballen
    >
    >
    >
    > > Thanks a bunch Brock,
    > >
    > > Guess its time to get a book or something and figure this out. I'm
    > > fairly new to alot of this stuff so learning as i go. If ya got any
    > > good reads please let me know.
    > >
    > > Thanks
    > >
    > > "Brock Allen" wrote:
    > >
    > >> This isn't something you'd call from ASP.NET since you're being
    > >> hosted in someone else's app (aspnet_wp.exe or w3wp.exe). My
    > >> recollection is that you need to call CoInitSec to do certain things
    > >> with the virtual server API, yes? This isn't really going to fly in
    > >> ASP.NET, so you'll need to build a seperate Win32 process where you
    > >> have control over the COM security model. This can be done from
    > >> managed code, but my recollection is that there are some snaffus. So,
    > >> you'll need to make this seperate process available via remoting or
    > >> some other IPC mechanism to your ASP.NET code.
    > >>
    > >> -Brock
    > >> DevelopMentor
    > >> http://staff.develop.com/ballen
    > >>> I'm developing an ASP page for my group at work that manages MS
    > >>> virtual Server images. If i make a call to initalize com by using
    > >>> COInitializeEX and security ect.. I get a dreadful meassage stating
    > >>> that i need to do this before any marshalling ect.. are done.
    > >>>
    > >>> It does not seem to matter were i do this (Page_Load, OnInit). Now i
    > >>> did decide to not worrie about this and make the api calls i need to
    > >>> make inot virtual server and it works, BUT, now when i try to get a
    > >>> class object of a remote virtual server i'm getting an error and was
    > >>> wondering if its because i didnt initialize COM.
    > >>>
    > >>> So the question is. For web based apps (Web Services, ASP) do i have
    > >>> to initialize com? If so how do i do it so i dont get that error ?
    > >>>
    > >>> Thanks!
    > >>>

    >
    >
    >
    >
     
    =?Utf-8?B?UE9uZnJp?=, Mar 17, 2005
    #5
  6. =?Utf-8?B?UE9uZnJp?=

    Mark Rae Guest

    "Brock Allen" <_hate_spam_too> wrote in message
    news:...

    > As for the best COM/.NET interop guide, check out ".NET and COM The
    > Complete Interoperability Guide" by Nathan.


    Yep - it's the only one you'll ever need.
     
    Mark Rae, Mar 18, 2005
    #6
    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. Matt
    Replies:
    4
    Views:
    1,389
    Roedy Green
    Jun 23, 2004
  2. Jacek Dziedzic
    Replies:
    1
    Views:
    297
    Moonlit
    Nov 1, 2003
  3. Replies:
    5
    Views:
    2,073
    Ben Pope
    Feb 14, 2006
  4. John
    Replies:
    7
    Views:
    331
    Bart Willems
    Mar 11, 2007
  5. Amelyan
    Replies:
    2
    Views:
    172
    Amelyan
    Apr 25, 2005
Loading...

Share This Page