Method 'XYZ' cannot be reflected

后端 未结 9 508
北荒
北荒 2020-12-11 04:26

We have consumed a third party web service and are trying to invoke it from an ASP.NET web application. However when I instantiate the web service the following System.Inval

相关标签:
9条回答
  • 2020-12-11 04:45

    Old thread but I had a different issue, Maybe of help to someone. referenced dlls were mixed up between two versions on data layer and service layer that caused the problem.

    0 讨论(0)
  • 2020-12-11 04:46

    I got the same message but mine was caused by a missing System.Runtime.Serialization.dll since I tried to run a 3.5 application on a machine with only .NET 2.0 installed.

    0 讨论(0)
  • 2020-12-11 04:51

    In my case I was getting a "method cannot be reflected" error due to that fact that in the class being returned by method, I had failed to expose a default parameter-less constructor.

    I was working in VB.NET. In my return class I had declared a "New(..)" method that took a couple parameters (because that is how I wanted to use it in my code). But by doing so, I had supressed the default (hidden) parameterless New() constructor that VB adds behind the scenes. Apparently the web service handler requires that a parameterless constructor be available. As soon as I added back into my class a parameterless New() constructor, it all worked fine.

    0 讨论(0)
提交回复
热议问题