2011-01-10 95 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