473,406 Members | 2,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

How to initalize COM from an ASP.NET

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!
Nov 19 '05 #1
5 940
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!


Nov 19 '05 #2
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!


Nov 19 '05 #3
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!


Nov 19 '05 #4
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!


Nov 19 '05 #5
"Brock Allen" <ba****@develop.com.i_hate_spam_too> wrote in message
news:15*********************@msnews.microsoft.com. ..
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.
Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jacek Dziedzic | last post by:
i.e. is writing std::string s=""; unnecessary as std::string s; suffices? TIA, - J.
11
by: BizTalk Architect | last post by:
Hello, I am days into this problem and I cant make heads or tails of it. Please post suggestions, I dont care how crazy they sound. Scenario: I have a TAPI C# application. (TAPI 3.0)
5
by: silverburgh.meryl | last post by:
How come I an not use class initialization to initalize inherited attributes? i have this code: B::B(A& a) { x = a.x; y = a.y; } class A {
1
by: Jon Rea | last post by:
Im a relatively new coder and am still learning the best way to do thigs - and I have always been told the best way to learn is by writing testing code and measuring, Could anyone shed some light...
2
by: Jon Rea | last post by:
Im a relatively new coder and am still learning the best way to do thigs - and I have always been told the best way to learn is by writing testing code and measuring, Could anyone shed some light...
3
by: Ara Kooser | last post by:
Hello all, I hope I am posting this correctly. I am running Python 2.4.2 on Slackware 11.0 using IDLE. I am in the process of learning python so I am writing a text adventure game using...
7
by: John | last post by:
For my code of radix sort, I need to initialize 256 buckets. My code looks a little clumsy: radix=] for i in range(255): radix.append() any better code to initalize this list?
1
by: sathishc58 | last post by:
HI All I tried out this program to know the difference between pointer-to-pointer and 2D Arrays. I compiled it using C++ compiler. main() { int **ptr=new ptr; }
0
by: lopina | last post by:
I have problem with sql server configuration tool. it can not be opened This error I get: Snap-in failed to initalize. Name:Sql server configuration manager ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.