简体   繁体   中英

Can I keep httpBinding off from client app when referencing another webservice in WCF?

I have WCF service and in the resource layer I have a reference to outer web-service. It only works when I copy the httpBinding configuration to the client app.config. Otherwise it will produce an error:

"Could not find default endpoint element that references contract"

The reason for wanting to do it is that I don't want to expose the 3rd party web-service to someone that want's to use my WCF service.

Can I keep the binding configuration in the resource .config file or maybe in the wcf Host project .config file ?

I'm not sure I fully understand the question, but you can always create the binding in code:

CustomBinding b = new CustomBinding()
//configure b
//...
Proxy p = new Proxy(b, "http://")

If I understand your scenario correctly, you want to point your app.config file to another “resource” config file that contains the WCF service / binding information.

As such, I think the following link details a solution:
Can I split system.serviceModel into a separate .config file?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM