views:

853

answers:

2

I have a custom C# component library (D1) that has a web reference, D1 is referenced by in library (D2) that makes call to methods in the web reference. D2 is loaded into a console application using reflection.

When I reference D1 above, in a test console application and make calls to the methods in the web reference. However, when I load it using reflection and make those same calls, receive the the following error: cannot call because it is a web method"

I have tried this using the .NET 2.0 and 3.0 framework.

Any thoughts?

+1  A: 

I got the same error when I was checking value in the debugger. I'm not sure how comparable that is to your reflection call.
My code called it just fine but the debugger threw this error.

Hopefully that may help someone

I don't see how it can help anyone because you didn't post the complete exception either.
John Saunders
A: 

It would be good practice for the class exposing the [WebMethod] tagged API to be a thin shim over the real implementation -- it is possible that the calls you see working are bypassing such a shim.

What does Reflector have to say about the assembly?

Steve Gilham