如何从 WCF 应用程序获取服务引用地址

How to get Service Reference Address from WCF Application

我需要向我的其中一个应用程序添加 服务参考。现在在 Add Service Reference 框中,有一个 Address 字段。如何从 WCF 应用程序获取地址字段或 URL 以将其添加到我的新应用程序中?

我尝试使用从 WCF 应用程序的属性中获得的 URL: http://localhost:53101/,但它给我这个错误:

There was an error downloading 'http://localhost:53101/_vti_bin/ListData.svc/$metadata'. The request failed with HTTP status 404: Not Found. Metadata contains a reference that cannot be resolved: 'http://localhost:53101/'. The remote server returned an unexpected response: (405) Method Not Allowed. The remote server returned an error: (405) Method Not Allowed. If the service is defined in the current solution, try building the solution and adding the service reference again.

我也试过构建 WCF 解决方案,然后再次尝试添加引用,但它给了我同样的错误。

我找到了我的问题。我只需要将 .svc 文件添加到我的 URL 的末尾就可以了。 :D