网络服务 URL 在网站中不起作用(作为服务参考)



我正在使用Visual Studio 2012来制作Web服务。我已经为 Web 服务编写了代码,但是当我尝试通过添加它作为服务引用(通过粘贴Web服务的运行URL)。它给出以下错误:

"There was an error downloading 'http://localhost:3849/WebService3/WebService.asmx/_vti_bin/ListData.svc/$metadata'.
 Unable to connect to the remote server
 No connection could be made because the target machine actively refused it   127.0.0.1:3849
Metadata contains a reference that cannot be resolved:  'http://localhost:3849/WebService3/WebService.asmx'.
 There was no endpoint listening at http://localhost:3849/WebService3/WebService.asmx that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
 Unable to connect to the remote server
No connection could be made because the target machine actively refused it 127.0.0.1:3849
 If the service is defined in the current solution, try building the solution and adding the service reference again."

我该怎么办?

  1. 尝试在浏览器中浏览您的服务 URL http://*:3849/WebService3/WebService.asmx/_vti_bin/ListData.svc,看看元数据是否可用
  2. 确保操作和返回类型的所有参数都是泛型,而不是特定于 .net

最新更新