Pergunta

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 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.

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

Please advice.

Foi útil?

Solução

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top