【发布时间】:2019-06-10 05:33:35
【问题描述】:
我收到了这个错误:
http://vkalra.in/WCF_SERVICE/RestServiceImpl.svc 上没有可以接受消息的端点监听。这通常是由不正确的地址或 SOAP 操作引起的。有关详细信息,请参阅 InnerException(如果存在)
InnerException - 远程服务器返回错误:(404) Not Found。
这是我的代码:
Binding binding = new BasicHttpBinding();
// Create endpointAddress of the Service
EndpointAddress endpointAddress = new EndpointAddress("http://vkalra.in/WCF_SERVICE/RestServiceImpl.svc");
ServiceReference1.Leave_Details emp = new ServiceReference1.Leave_Details();
emp.empid = items.empid;
emp.fromdate = "01-04-2019";
emp.todate = "04-06-2019";
emp.tabt = "1";
emp.jdis = "0";
try
{
ServiceReference1.RestServiceImplClient service = new ServiceReference1.RestServiceImplClient(binding, endpointAddress);
string levbal = service.Leave_Calculation(emp);
}
catch(Exception ex)
{
}
【问题讨论】:
-
您需要在此处提供更多背景信息和信息!!突出的一件事:您正在使用
BasicHttpBinding这是基本的 SOAP 绑定,但您尝试联系的 URL 似乎是 REST - 这两个不匹配,您需要使用WebHttpBinding与 REST 端点通信..... -
请提供一些示例,以便在服务 Leave_Calculation 中从我们的控制器中的 rest 服务获取数据是采用 5 个参数并返回字符串数据的方法,我是 WCF 服务中的新手?
标签: wcf