C# 使用带有参数的WCF
我不能用URL中的参数使用WCF 我在WCF中的方法:C# 使用带有参数的WCF,c#,wcf,web-services,wcf-rest,C#,Wcf,Web Services,Wcf Rest,我不能用URL中的参数使用WCF 我在WCF中的方法: 登录(用户,通行证) 我的aspx.cs代码: Service1Client respLogin=newservice1client().Login(用户,通过) My web.config: <system.serviceModel> <behaviors> <endpointBehaviors> <behavior name
登录(用户,通行证)
我的aspx.cs代码:
Service1Client respLogin=newservice1client().Login(用户,通过)代码>
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>
错误消息:没有可接受的端点侦听http://1.234.567:8/service1.svc/Login 消息
这是正确的,http://1.234.567:8/service1.svc/Login
不存在(我需要在URL中添加参数),但http://1.234.567:8/service1.svc/Login/user/pass
确实存在并且响应正常
我无法添加用户参数并传入URL
如何使用WCF和C#添加用户参数和传入URL
谢谢朋友们 看起来您忘记了用新的设计来装饰您的服务实现。这就是在WCF RESTful服务中指定URL参数的方式