简体   繁体   中英

Web reference for WCF service

I am consuming WCF service in my VS 2005 solution by adding as webreference. Ex: Today my WCF url address is - http://'ip-001':/service If tomorrow i deployed my service in ip-002 machine, in this case i have to add again the service reference by using the http://'ip-002':/service or i have to change only config file. Note: no service changes has made from ip-001 to ip-002. Let me know without any service changes only url is changes in this case i have to change only config will it work?

as long as you don;t have security turned on this should be fine just changing the address. If you have security enabled then there are two issues to be aware of

If they are using SSL then you need to make sure that the certificate authority they are using is trusted on the client machine

If the client is identifying the remote machine by DNS then if you want to support more than one remote mahcine you have to switch to somethinglike certificate reference

in this case only changing the config will work.

The add web reference just contacts the meta data exchange endpoint and downloads the wsdl, which it then uses to generate the client side code to comply with the contract. you don't need to do this, you could hand craft the correct client side code, or share libraries with the server to have the same client side code.

Once you have this the client and server communicate with soap messages generated from that code. It is these soap messages that are important. As long as the server recieves correctly constructed messages and the client correctly decodes the messages from the server everything will work. The fact that it is now hosted on another server is moot.

Remember your service could be called by a client which is not .net based, so all that client side code could be generated in a different language, or the messages could be sent by someone manipulating the bits with magnets

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