Explore model answers categorized by subjects like Java, HTML, DBMS, and more.
Windows Communication Foundation (WCF) is an SDK for developing and deploying services on Windows.and it (Code named Indigo) is a programming platform and runtime system for building, configuring and deploying network-distributed services.
WCF provides a runtime environment for your services, enabling you to expose CLR types as services, and to consume other services as CLR types. It is the latest service oriented technology; Interoperability is the fundamental characteristics of WCF.
Windows Communication Foundation (WCF) is unified programming model provided in .Net Framework 3.0. WCF is a combined features of Web Service, Remoting, MSMQ and COM+. WCF provides a common platform for all .NET communication.
It consists of three main points: Address, Binding and Contract. The Client, how to communicate with the service is done by endpoint.
1. Web Service can be hosted in IIS but WCF can be hosted in IIS, windows activation service, Self-hosting, Windows service
2. [WebService] attribute has to be added to the class. In WCF [ServiceContraact] attribute has to be added to the class
3. In Web Srvices[WebMethod] attribute represents the method exposed to client,In WCF [OperationContract] attribute represents the method exposed to client
4. Web services One-way, Request- Response are the different operations supported in web service In WCF One-Way, Request-Response, Duplex are different type of operations supported in WCF
There are four types of Contracts in WCF-
1. Service contracts
2. Data contracts
3. Fault contracts
4. Message contracts
In WCF, all services expose contracts. The contract is a platform-neutral and standard way of describing what the service does. WCF defines four types of contracts.
Define which operations the client can perform on the service. Service contracts are the subject of the next chapter, but are used extensively in every chapter in this book.
Define which data types are passed to and from the service. WCF defines implicit contracts for built-in types such as int and string, but you can easily define explicit opt-in data contracts for custom types
Define which errors are raised by the service, and how the service handles and propagates errors to its clients.
Allow the service to interact directly with messages. Message contracts can be typed or untyped, and are useful in interoperability cases and when there is an existing message format you have to comply with.
1)IIS
2)Self Hosting
3)WAS (Windows Activation Service)
The main components are
1. Service class
2. Hosting environment
3. End point
1)HTTP
2)TCP
3)Peer network
4)IPC (Inter-Process Communication over named pipes)
5)MSMQ
Throttling enables we to restrain client connections and the load they place on our service. Throttling enables we to ignore maxing out our service and the underlying resources it allocates and uses. If the settings we configure are exceeded, WCF will automatically place the pending callers in a queue and serve them out of the queue in order,When throttling is engaged. While pending in the queue,If the client\'s call timeout expires, the client will get a TimeoutException.
Configuring an endpoint administratively requires placing the endpoints in the hosting process config file. For example, given this service definition:namespace endname
{
[ServiceContract]
interface IMyContract
{...}
class MyService : IMyContract
{...}
}
Data contract class can be the subclass of another data contract class. Since the DataContract attribute is not inheritable so WCF requires that every level in the class hierarchy explicitly opt in for a given data contract[DataContract]
class Contact
{
[DataMember]
public string FtName;
[DataMember]
public string LName;
}
[DataContract]
class Customer : Contact
{
[DataMember]
public int CNumber;
}
WCF needs to enable both backward and forward compatibility, without even sharing types or version information.
There are three main version scenarios:
1. New members
2. Missing members
3. Round tripping, where a new version is passed to and from an old version, requiring both backward and forward compatibility