tags:

views:

38

answers:

1

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.

A: 

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

marc_s
I am doing the same thing. But this address is not known. It can be anything according to client server configuration. If i change it after publishing the application to the client configuration,it gives a hash mismatch with manifest exception. I am attaching the config<endpoint address="http://192.168.0.161/OA.Smart.ServiceHost/FileTransferService.svc" behaviorConfiguration="defaultServiceBehaviour" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFileTransferService" contract="FileTransferServiceReference.IFileTransferService" name="BasicHttpBinding_IFileTransferService">
Rohit
please put additional info into your original question - in the comments, it's not readable at all - thanks!
marc_s
But if it's hosted in IIS on the server side, then the address is fixed and known..... it's the server's machine name (or IP), and the virrtual directory where you *.svc file lives..... I'm not getting what you're trying to do here.....
marc_s
the address i am pointing is of one server. Client wants to deploy this same configuration on another server without changing anything in the published application.The server IP will be different in that case. How will i update it.
Rohit
If you have two separate server, you cannot get away without config change - that's the WHOLE POINT of having stuff like that in CONFIG, so you can easily CHANGE IT. But you need to change it!
marc_s