Re: Cannot load .NET COM Object into ASP (Classic) Application Object

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



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.



.



Relevant Pages

  • Execution permission cannot be acquired on SqlConnection open() within .NET exposed as COM
    ... I have an application in ASP that I am attempting to migrate to ... generated assemblies in the bin of my web app. ... I can access the COM interface and use its methods. ... There are two .NET projects being used, one wrapping database access ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • ASP to COM to .NET Interoperability Problem
    ... We have an ASP application which needs to access a .NET application through ... We have implemented this interface with a multithreaded COM object ... The .NET dll contains interface code to the .NET application to be ... debugger where we find a memory access violation error. ...
    (microsoft.public.win32.programmer.ole)
  • Re: Cannot load .NET COM Object into ASP (Classic) Application Object
    ... This is an important distinction and the root of your issue. ... > The root of my issue is that the .NET CCW uses its own interface for the ... > specific CLSID in order to load an object into the ASP Application object. ... Microsoft .NET Components fail the agility test that Active ...
    (microsoft.public.dotnet.framework.interop)
  • Re: ASP Web Development
    ... Take a look at www.foxweb.com to interface with VFP. ... but I've been happy with Foxweb. ... > also told by someone else that ASP is very slow and not worth it, use PHP ...
    (microsoft.public.fox.programmer.exchange)
  • COM Interop - Access to the path XXX is denied.
    ... (read/write). ... the class library provides a COM interface, ... will be used in good old asp pages. ... i reference it from a console test application. ...
    (microsoft.public.dotnet.languages.csharp)