Reputation: 13
I cant consume WCF with parameters in URL
My method in WCF:
Login(user,pass)
My aspx.cs code:
Service1Client respLogin = new Service1Client().Login(user, pass);
My web.config:
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="AllocationBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<client>
<endpoint name="ServiceReference1.IService1"
address="http://1.234.567:8/service1.svc"
binding="webHttpBinding"
behaviorConfiguration="AllocationBehavior"
contract="ServiceReference1.IService1" />
</client>
</system.serviceModel>
Error Message: There was no endpoint listening at that could accept http://1.234.567:8/service1.svc/Login message
This is correct, http://1.234.567:8/service1.svc/Login
does not exist (I need to add parameters in URL), but http://1.234.567:8/service1.svc/Login/user/pass
does exist and response ok!!
I can't add parameters user and pass in URL ...
How I add parameters user & pass in URL using WCF and C#?
Thanks friends!!
Upvotes: 1
Views: 435
Reputation: 13077
It looks like you've forgotten to decorate your service implementation with the WebGet attribute. That's how URL parameters are specified in WCF RESTful services.
Upvotes: 1