Wcf – dynamic refeences for WCF service

hostingwcf

I have a WCF service hosted on IIS. I have a smartclient application which calls this WCF service through endpoints defined in app.config file.

Now when i publish this application using this configuration, IT throws an exception saying that no endpoint is listening at localhost.

How can i make it dynamic. By dynamic I mean IF i update the endpoint in app.config file the application should pick up that url instead of the url with which the application was published with.

I remember i could do it in webservices. Please help.

Best Answer

Your app.config would most likely contain something like:

<client>
  <endpoint name="...." 
            address="........" 

Check the address - that's the URL you're trying to connect to. You need to provide the server's address and port and path - no localhost, of course.

<client>
  <endpoint name="...." 
            address="http://yourserver/yourVirtualDir/YourService.svc" 

That should do the trick.

Marc

Related Topic