How to initalize COM from an ASP.NET

G

Guest

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!
 
B

Brock Allen

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

Guest

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
 
B

Brock Allen

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

Guest

HeHe, yeah very painful but its been a great experiance. Thanks a bunch for
the tip ont he book. I will check it out.
 
M

Mark Rae

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top