문제

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

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top