tags:

views:

74

answers:

2

I am learning WCF,one of the benefits of WCF is that you can use WCF even the client and service are not in the same network.Can anyone explain why? Why using normal asp.net services, .NET remoting or Windows enterprise service client and service have to be in the same network?

Another question is that does the client needs to have a service contract interface and data contract? I assume not ,but how the client understand the type returned from the WCF services?

+1  A: 

Edit: Reflecting More comments

A primer on WCF (such as What Is Windows Communication Foundation?) is a good place to start. WCF can use SOAP to implement the contracts way down deep. WCF also uses a variety of communication facilities within windows (and any custom ones you want to create) so talking across machines is built in.

The very essence of contract (IMO) implies that this is present on both sides of the communication. In a pure .net cases I've usually put the contract definitions in separate assemblies and share them. In other places I've used WSDL to be the main contract definition so that the client and service share definitions.

Edit: Answering comments

You can knock up simple examples of communication in WCF easilyy (provided you know the basics of comms on windows including firewalls etc). However doing something custom is not easy but there are many many resources on the web and books to help you get there.

The books i used:

Another question on SO with a set of resources is "WCF for the Totally Clueless"

Preet Sangha
+1 I don't think WCF is something anyone can just "dive in".. seriously...
chakrit
Nice set of resources
Guy Starbuck
Hey mate , I can make the wcf working and reading the books.Here are just the questions I come across.I do not want to read the whole books to find the answers if you can give me a brief explanation ,it would be much easier for me.
Ybbest
-1: WCF does not use SOAP all the time. It's independent of message format. For example, netMsmqBinding doesn't use SOAP, nor do the web* bindings.
John Saunders
Thanks john - I've edited the answer to reflect this.
Preet Sangha
A: 

I don't know where you read that a benefit of WCF is that it allows the client and server to be on different networks. They can already be on different networks using .NET Remoting or DCOM (Enterprise Services).

The client does need to know the service contract and any other contracts required in order to use the service. This can be provided through WSDL or the Metadata Exchange Protocol (mex). If using .NET on both sides, then it is possible to share the contract assemblies, but this introduces a coupling between client and service.

John Saunders
Hey I am watching some appdev WCF services training,the benefit has been said there.That's why I am confused and ask the questions here.I can not figure out why the network location matters.
Ybbest
The network location does not matter. Can you post a link to the training where this is said?
John Saunders
It is inside the video itself there is no link I can point to it.I can find any other places said so and I think it must be a mistake to it.Thansk for your answers.
Ybbest
No, I meant a link to the video.
John Saunders