简体   繁体   中英

Dynamically add reference of WCF service

I am creating a WCF service and Client application. I want to use the service in the client application.

The location where the WCF service will be hosted is not yet finalized. I want to dynamically add the reference of the hosted WCF service without building the client application. How can I achive this?

Thanks,

Ram

Do this:

  • create the client as you would in any normal case
  • change the service URL in the config when the service "moves" around

I think this would be by far the easiest solution.

If you insist on a dynamic proxy - there's a sample of a WCF dynamic proxy here:

http://code.msdn.microsoft.com/netfxsamples/Wiki/Print.aspx?title=WCF%20samples&version=8&action=Print

Scroll down a bit to find the sample. It was C# code to show you how to dynamically create a WCF proxy all in code.

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