473,385 Members | 1,570 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,385 software developers and data experts.

ASP.Net doesn't like my ServicedComponent class? [C#]


Hi everyone,

I have a toy class that inherits from ServicedComponent and a
hand-crafted interface. It looks like this:

[Transaction(TransactionOption.Supported)]
public class myclass: ServicedComponent, IReadData //IReadData is the
hand-blown interface
{
public string GetString()
{
return "hello";
}

[AutoComplete]
public string GetData(string strParameters)
{
return "goodbye";
}
}
}

I've put this into a COM+ package, using regsvcs.exe, and made the package
as "open" as possible-- no security access checks, for instance. It's
running as a server application under COM+.

Here's the trouble: calling the class's GetData() method in a console app
works fine, but the same call from an ASP.Net page gives an error that says:
"System.InvalidCastException: QueryInterface for interface
Interfaces.IReadData failed."

Here's my definition of the IReadData interface-- it's simple enough:

public interface IReadData
{
{
string GetData(string strParameters);
}
}
Am I doing something wrong here that I can't see? Are you allowed to
inherit from interfaces at the same time as ServicedComponent, or are there
restrictions regarding this I don't know about? Or, is there something else
entirely at work? I'm scratching my head as to why this is happening.

Thanks for any and all help.

-Jim
Nov 19 '05 #1
2 1323
Hi Jim,

sounds like the assembly versions ASP and the COM+ server uses differ -
try to undeploy from ES, remove from the GAC (all versions), rebuild,
reregister in GAC and redeploy your assembly. And make that no copy of
the assembly resides somewhere in the ASP.NET directory.

/Jo

Jim Bancroft wrote:
Hi everyone,

I have a toy class that inherits from ServicedComponent and a
hand-crafted interface. It looks like this:

[Transaction(TransactionOption.Supported)]
public class myclass: ServicedComponent, IReadData //IReadData is the
hand-blown interface
{
public string GetString()
{
return "hello";
}

[AutoComplete]
public string GetData(string strParameters)
{
return "goodbye";
}
}
}

I've put this into a COM+ package, using regsvcs.exe, and made the package
as "open" as possible-- no security access checks, for instance. It's
running as a server application under COM+.

Here's the trouble: calling the class's GetData() method in a console app
works fine, but the same call from an ASP.Net page gives an error that says:
"System.InvalidCastException: QueryInterface for interface
Interfaces.IReadData failed."

Here's my definition of the IReadData interface-- it's simple enough:

public interface IReadData
{
{
string GetData(string strParameters);
}
}
Am I doing something wrong here that I can't see? Are you allowed to
inherit from interfaces at the same time as ServicedComponent, or are there
restrictions regarding this I don't know about? Or, is there something else
entirely at work? I'm scratching my head as to why this is happening.

Thanks for any and all help.

-Jim

Nov 19 '05 #2
Thanks for the advice; I've recompiled everything, pulled components out of
the GAC, put them back in, pulled them out again, run regsvcs.exe more times
than I care to count-- and I'm just where I started.

Interestingly, my code does work if I quit inheriting from ServicedComponent
and yank out any COM+ method attributes. In that case my ASP.Net page has
no problem querying for, and using, my GetData() method. But as soon as I
inherit from ServicedComponent again and put the component back under a COM+
application, ASP immediately acts like it's never heard of my interface--
strange indeed. I'll keep plugging away....
"Jo Siffert" <jo********@gmx.net> wrote in message
news:un**************@TK2MSFTNGP15.phx.gbl...
Hi Jim,

sounds like the assembly versions ASP and the COM+ server uses differ -
try to undeploy from ES, remove from the GAC (all versions), rebuild,
reregister in GAC and redeploy your assembly. And make that no copy of the
assembly resides somewhere in the ASP.NET directory.

/Jo

Nov 19 '05 #3

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

Similar topics

0
by: Steve M | last post by:
I have a class derived from ServicedComponent and I was able to register it using regsvcs when I used VS.NET 2000. Now that I have switched to 2003 it no longer registers and displays the following...
5
by: Stefan G. | last post by:
Hi, is it possible to use custom context-attributes with serviced components? public class Logging : ContextAttribute { public Logging() {...} public override void...
18
by: David | last post by:
Hello, I'm writing a C# class library that may be called by non-.Net applications. The main class of this class libray is a ServicedComponent so that non-.Net application can call this class as a...
5
by: jason | last post by:
i have a c# class library that is being compiled with the "Register for COM Interop" flag set to "True." it compiles just fine. however, when i go into the Component Services administrative tool...
2
by: Kevin Jackson | last post by:
If we are using Library ServicedComponents is it possible to get to the ASP.NET session stuff from a ServicedComponent?
3
by: zlf | last post by:
I am asked to complete a COM+ component, there is a class A derived from ServicedComponent. However, when executing , exception is thrown. Messaged: Unhandled Exception:...
2
by: shanmani | last post by:
Hi, I am developing a .NET application which will invoke the methods from different COM / .NET DLLs. While invoking methods from .NET DLLs, I am encountering the following error. I have also...
3
by: GoogleEyeJoe | last post by:
Dear ladies and gents, I'm trying to determine whether the .NET Framework implements a means of transactional processing without the need for a database. Essentially, I'd like to enlist...
0
by: Arif Khan | last post by:
I am getting folllowing error in one of the service components. I have not override base class's (ServicedComponent ) Deactivate function. Also it's library component called by asp.net worker...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.