Question

I have:

  1. WCF Service [Application 1]
  2. Logic communicating with this service [Project1 Application2]
  3. Web Page using this logic [Project2 Application2]

In Logic project I added service reference to Service. In WebPage I added project reference to Logic.

Now endpoints to Service are definied in Logic project so I cannot connect to Service from WebPage.

I know that I solution is to copy part of Logic config to WebPage config, but I don't think it's a good solution.

I would like to have Logic as a black box. I don't know if I wouldn't change it to another service, maybe something different, so I don't want to WebPage "know" how Logic works.

Is there any better solution? Something I could do in Logic project which would make WebPage know how to connect to Service?

I'm getting exception: Could not find default endpoint element that references contract

Was it helpful?

Solution

The other option is to configure Logic by placing the endpoints in the code instead of the configuration file. When you create your web service client, use this overload, which takes a Binding and EndpointAddress as parameters. In the code of your Logic class, just supply those parameters in the code instead of letting it read them automatically from the config file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top