tags:

views:

364

answers:

1

hi, i having more than Three web services, In that one is master site,and Others are client sites.

In My User Interface One Text box is Available ,In that text box i need to give Destination End Point address from that Text box Value i need call the Client Service.

for Example:

Client1 end point Service Name:

                 http://localhost:1524/WebServiceService.svc" 

Client2 end point Service Name:

By

Rajagopalk

                 http://localhost:8085/WebServiceService.svc" 

if i give "localhost:1524" in Text box Client1 Service will call, if i give "localhost:8085" in Text box Client2 Service will call,

+2  A: 

Are you hosting your WCF services in IIS ? In that case, your service address is determined by the IIS configuration and the virtual directory where your service's *.svc file exists.

So to change something on the server, you need to check and modify the IIS configuration.

To change on the client side, there's a web.config (for ASP.NET webs) or an (applicationName).exe.config where your endpoint definition should be contained - change the endpoint address there:

<client> 
   <endpoint name="YourEndpointName"
       address="http://localhost:8085/WebServiceService.svc" 
       binding="......." bindingConfiguration="............."
       contract="..................." />
</client>

You need to specify the complete target web service address in the address= attribute of your <endpoint> configuration element.

You can define multiple endpoints for the same service, and pick which one to use when you instantiate the client proxy:

MyServiceProxy client = new MyServiceProxy("name of endpoint configuration");

and with this, you can switch between several definitions of endpoints easily.

UPDATE: If you want to programmatically set your client address from code, you need to do the following when creating your client proxy:

// create custom endpoint address in code - based on input in the textbox
EndpointAddress epa = new EndpointAddress(new Uri(textbox.Text));

// instantiate your cilent proxy using that custom endpoint address 
// instead of what is defined in the config file
MyServiceProxy client = new MyServiceProxy("name of endpoint configuration", epa);
marc_s
hi, <client> <endpoint name="YourEndpointName" address="http://localhost:8085/WebServiceService.svc" binding="......." bindingConfiguration="............." contract="..................." /></client>in Address Node instead of localhost:8085 i need to give Text Box value. Please explain briefly.because i am new to WCF
Rajagopalk
please don't put xml config stuff into comments - really hard to read. UPDATE your original question with additional info!!
marc_s
hi, i need to send data from One server to many clients.depending upon their tasks for that i need to maintain setting in server,In that setting i need to mention the Client URI ,depending upon that URI i need to access that client service i need to transfer data to that client.one more thing is how to maintain App.Config file also. Thanks ,Rajagopalk
Rajagopalk