Re: .Net COM interop initialization question

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Greg...

A lot of this is very old code... The ISAPI filter is, in fact, old C++.
The COM objects it's referencing *used* to be in C++ but as various pieces
were migrated to .Net, the same interface was exposed to the old code as .net
COM interop. Mostly the classes are abstractions of database interfaces
(logical names for dbs controlled by a central class).

They are inproc com components, so there's no interprocess communication
going on.

And yes, this does mean that we have the same classes running twice for
every w3wp process running. We have one app domain for the com objects
invoked by the C++ and another when the aspx pages actually run.

The larger task of rearchitecting everything is more than people have been
willing to bite off so far...

As I say, I read an article or 2 found through Google where they say .net
com interop will try to look for <app>.config to initialize itself (though no
one specified what <app> would be or how the interaction with unmanaged code
would work).

I took a gamble that
a) the .net com interop code would be looking for the invoking process name
(w3wp.exe.config)
b) that since the parent was unmanaged and wouldn't have already loaded an
<app>.config that the com interop would
c) given b) that I'd have a little time in the unmanaged code to set the
directory before the com objects were called so they'd be looking in the
right place.

Seems some part of the above wasn't working the way I was hoping.

Maybe you're right - you can spend so much time trying to work around the
gorilla in the room that it may just be more profitable to tackle some of the
old problems.

Thanks
Mark


"Gregory A. Beamer" wrote:

=?Utf-8?B?TWFyaw==?= <mmodrall@xxxxxxxxxxxxx> wrote in news:AD72DF21-3F40-
4B35-960A-38106366A6FB@xxxxxxxxxxxxx:

Thanks for answering... I'm not sure what you're getting at with "Think
about how the IIS process works".


DISCLAIMER: Oversimplification in process

When you say ISAPI, do you mean something you wrote in C++ as an ISAPI
filter or do you mean a .NET HTTPhandler that calls COM components? I was
thinking the later when I started answering this thread and may be off
track. If so, apologies.

COM is a very complex subject, especially in regards to .NET.

When you cross the boundary from managed to unmanaged code, you open
yourself for errors. The standard .NET callable wrapper simply acts as a
proxy between the COM bits and the .NET bits, but this may not be enough,
especially if you have multiple applications hitting the same bits.

In newer versions of windows, there are some ways around the COM issue.
And, if the component is installed in COM+, you have other options. But the
person who programmed the COM component may have still boxed you in with
the way they set things up.

Since I don't know the actual component, I am shooting in the dark hoping
to hit a target. ;-)

IIS sits on top of COM+ (the MTS part primarily, where it has sat since IIS
4.0, at least I don't think earlier versions used MTS, but someone will
likely correct me if so). .NET sits on top of IIS. There is already a lot
of interop with the native components to get web processes finished, even
though some is going away as they retool .NET, the CLR, etc.

What I am attempting to do here is give you some places to look other than
a single document that is designed to solve a single problem. Even if the
problem sounds just like yours, the installation of the COM bits on the
server may null and void the solution.

As for COM: Depending on the component you are using, you may be completely
leaving the IIS/COM+ process to access the component. In these cases, it is
almost guaranteed to be a bottleneck.

if you don't mind me asking, what is the COM component in question?


Long term, I still think re-examining what the component does, and finding
a .NET option, is probably the wisest solution.

Peace and Grace,

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
.

.



Relevant Pages

  • Re: IIS (or Isapi) adds Connection header to response
    ... I would never rely on a bug in a browser implementation as the means to get ... > I dont currently have access to the ISAPI code. ... available on any other IIS version. ... NTLM header since it is no longer useful. ...
    (microsoft.public.inetserver.iis.security)
  • Re: ISAPI vs. HTTPModule
    ... which parses the request and dispatches it to IIS in usermode. ... extension of the request is determined, and then sent to its handler. ... > ISAPI will not be able to access any .Net intrinsics/events. ...
    (microsoft.public.inetserver.iis)
  • Re: IIS Isolation Mode
    ... We create some files and read some files in the ISAPI. ... something that requires local system privileges, and if it doesn't have it, ... would guess that the IIS 5 version will work correctly on IIS 6, since ADSI ...
    (microsoft.public.inetserver.iis.security)
  • Re: IIS error with ISAPI and virtual directory to remote svr .. 40
    ... Web Server on machine B ... In particular, with some authentication protocols, your ISAPI ... Then immediately stop IIS. ... virtual directory it impersonates with 'user a''s account for security ...
    (microsoft.public.inetserver.iis)
  • Re: Touchy Subject
    ... > for one obvious reason. ... Current Windows is build in unmanaged code, so, ... > managed code directly to machine code, skipping any interop. ... > console applications. ...
    (microsoft.public.dotnet.framework.clr)