Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to initalize COM from an ASP.NET

Reply
Thread Tools

How to initalize COM from an ASP.NET

 
 
=?Utf-8?B?UE9uZnJp?=
Guest
Posts: n/a
 
      03-16-2005
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!
 
Reply With Quote
 
 
 
 
Brock Allen
Guest
Posts: n/a
 
      03-16-2005
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!
>




 
Reply With Quote
 
 
 
 
=?Utf-8?B?UE9uZnJp?=
Guest
Posts: n/a
 
      03-16-2005
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!
> >

>
>
>
>

 
Reply With Quote
 
Brock Allen
Guest
Posts: n/a
 
      03-16-2005
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!
>>>




 
Reply With Quote
 
=?Utf-8?B?UE9uZnJp?=
Guest
Posts: n/a
 
      03-17-2005
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!
> >>>

>
>
>
>

 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      03-18-2005
"Brock Allen" <(E-Mail Removed)_hate_spam_too> wrote in message
news:(E-Mail Removed). ..

> 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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
any better code to initalize a list of lists? John Python 7 03-11-2007 07:12 PM
Using class initialization to initalize inherited attributes silverburgh.meryl@gmail.com C++ 5 02-14-2006 09:34 AM
good practice to initalize all instance variables with type String to emptry string?? Matt Java 4 06-23-2004 06:14 AM
Are std::strings guaranteed to default-initalize to ""? Jacek Dziedzic C++ 1 11-01-2003 08:25 PM



Advertisments