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

时间:2013-10-18 06:47:56

标签: asp.net wcf web-services

我正在使用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 个答案:

答案 0 :(得分:0)

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