semi Resolved
It appears that the problem exists only when running in debug mode,
and only when running the commands thru the immediate / watch windows.
It just works this way.
Thanks for the answers.
I’m trying to consume a WCF service from .net 2.0 application.
I’ve added it as a web reference, the class appeared in the intellisense.
But, calling a method from the service returns an error of
Cannot call <method> because it is a web method
Service
[ServiceContract]
[AspNetCompatibilityRequirments(RequirmentsMode = ApsNetCompatibilityRequirments.Allowed)]
public class ConsumerResponder
{
[OperationConract]
public List<string> GetStrings(int a, int b, int c)
{
return new List<string>{"hi"};
}
}
Services web.config
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.ServiceModel>
<behaviors>
<endpointBehaviors>
<behavior name="bh1">
<endpointDiscovery enabled="true" />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior>
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetada httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
<service name="Service.ConsumerResponder">
<endpoint address="" behaviorConfiguration="bh1" binding="basicHttpBinding" contract="Service.ConsumerResponder" />
<endpoint address="mex" binding="wsHtppBinding" contract="IMetadataExchange" />
</service>
</services>
</system.ServiceModel>
</configuration>
Usage
using(ConsumerResponder cf = new ConsumerResponder())
{
List<string> result = cf.GetStrings(1, true, 2, true, 3, true);
}
Tested from another places and in debug, and the service really returns values.
May be you can try this instead of the class.