Re: Cannot load .NET COM Object into ASP (Classic) Application Object
- From: "Ken Granderson" <ken@xxxxxxxxxxxxx>
- Date: Mon, 18 Jul 2005 18:12:55 -0400
Scott M.said:
> First, we need to be clear. You don't build COM objects from .NET. What
> you can do is build a .NET managed assembly that is accessible via COM
> interfaces. This is an important distinction and the root of your issue.
While this may be the case from a purist standpoint, my experience using
..NET assemblies built with the 'Register for COM Interop' option checked
implies that the .NET managed assembly 'walks like a COM object' and 'talks
like a COM object' from the perspective of most code that knows how to use
COM objects.
The root of my issue is that the .NET CCW uses its own interface for the
UnMarshalClass method, and ASP.DLL requires that this interface have a
specific CLSID in order to load an object into the ASP Application object.
> Since the CLR doesn't know about the Classic Application object, you get
the
> error you are getting.
As I said in my post,
"When I tried to put my first COM object into the ASP Application..."
I did not say:
"When I tried to put the ASP Application object into my COM object ..."
I am not trying to reference the ASP intrinsic objects from my .NET code. I
do not imagine that would work, even if I created a reference to the objects
exposed by ASP, as they would not be running in the context of the IIS
process used by ASP Classic.
In my ASP Classic code, after I instantiate my .NET object that looks like a
COM object to ASP Classic via:
Set obj = Server.CreateObject("DotNetAssembly.ClassName")
while ASP Classic is happy using the object directly, when I try and store
my object in the ASP Classic Application object via:
Set Application("Test") = obj
I get ASP error 0197, as documented in
http://support.microsoft.com/default.aspx/kb/822828:
By default, Microsoft .NET Components fail the agility test that Active
Server Pages (ASP) performs for application scope objects. By default, the
Component Object Model (COM) callable wrapper (CCW) object that is used for
COM interoperability implements the IMarshal interface, and its
implementation is similar to the free-threaded marshaler (FTM)
implementation. However, because the unmarshal class that is returned by the
IMarshal::GetUnmarshalClass method is not the class identifier (CLSID) of
the FTM (its value is {3F281000-E95A-11d2-886B-00C04F869F04}), the agility
test fails and you receive the following error message:
Application object error 'ASP 0197 : 80004005'
Disallowed object use /LM/W3SVC/1/Root/SRQ030513600956/global.asa, line 7
Cannot add object with apartment model behavior to the application intrinsic
object.
This appears to be the root of my issue.
.
- Follow-Ups:
- References:
- Cannot load .NET COM Object into ASP (Classic) Application Object
- From: Ken Granderson
- Re: Cannot load .NET COM Object into ASP (Classic) Application Object
- From: Scott M.
- Cannot load .NET COM Object into ASP (Classic) Application Object
- Prev by Date: Re: Cannot load .NET COM Object into ASP (Classic) Application Object
- Next by Date: Re: Cannot load .NET COM Object into ASP (Classic) Application Object
- Previous by thread: Re: Cannot load .NET COM Object into ASP (Classic) Application Object
- Next by thread: Re: Cannot load .NET COM Object into ASP (Classic) Application Object
- Index(es):
Relevant Pages
|