0

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
  • Please post the complete exception. Post the output of ex.ToString(). Also, in terms of architecture, you should only be calling methods exposed directly by the component. If such a method called a web method, that would be fine. Commented Jun 29, 2009 at 16:12

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

I don't see how it can help anyone because you didn't post the complete exception either.
0

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?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.