2011-01-10 93 views
1

我创建了Silverlight应用程序使用的WCF服务(去年),它没有元数据(没有IMetadataExchange端点)。WCF:是否需要元数据才能使用WCF服务?

现在我需要WCF服务被Windows控制台应用程序使用,并且我无法添加对服务的引用。我点击“添加服务”发现解决方案的服务,选择“必需”服务并点击“确定”按钮。

而不是服务引用创建我得到了以下错误:

The HTML document does not contain Web service discovery information. Metadata contains a reference that cannot be resolved: 'http://localhost/EnrollmentService.svc'. There was no endpoint listening at http://localhost/EnrollmentService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. The remote server returned an error: (404) Not Found. If the service is defined in the current solution, try building the solution and adding the service reference again.

我应该增加对WCF服务也应该是另一种解决方案元数据支持工作?

请指教。

回答

4

您可以在不暴露元数据的情况下使用WCF Service

元数据用于通过Visual Studio或任何其他工具生成代理。因此,如果您不公开元数据,您将不得不自己创建/编写这些代理类。

只要你使用正确的服务地址和正确的数据合同,你就可以走了。

Accessing WCF service without creating Proxy

+0

所以我需要自己生成这些代理?不,我会更好地添加元数据支持...但是,谢谢你的回答 – Budda 2011-01-10 15:09:07