开发者

WCF: Are metadata required to consume WCF service?

开发者 https://www.devze.com 2023-02-03 05:42 出处:网络
I created WCF service (last year) that is consumed by Silverlight application and it doesn\'t have metadata (doesn\'t have IMetadataExchange endpoint).

I created WCF service (last year) that is consumed by Silverlight application and it doesn't have metadata (doesn't have IMetadataExchange endpoint).

Now I need WCF service to be consumed by windows console application and I can't add reference to service. I click 'Add Service' discover solution's services, selected 'required' service and clicked 'Ok' button.

Instead of service reference created I got the following error:

The HTML docum开发者_高级运维ent 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.

Should I work on adding metadata support for WCF service or it should be another solution?

Please advice.


You can use a WCF Service without exposing metadata.

Metadata is used to generate a proxy by Visual Studio or any other tool. So, in case you don't expose metadata, you are going to have to create/write these proxy classes yourself.

As long as you use correct service address and right data contracts, you are good to go.

Accessing WCF service without creating Proxy

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号