Quantcast
Channel: Programming – Xinyustudio
Viewing all articles
Browse latest Browse all 284

WCF Learning Note (I)

$
0
0
  1. How to: Define a Windows Communication Foundation Service Contract
    using System; // Step 5: Add the using statement for the System.ServiceModel namespace using System.ServiceModel; namespace Microsoft.ServiceModel.Samples { // Step 6: Define a service contract. [ServiceContract(Namespace = "http://Microsoft.ServiceModel.Samples")] public interface ICalculator { // Step7: Create the method declaration for the contract. [OperationContract] double Add(double n1, double n2); [OperationContract] double Subtract(double n1, double n2); [OperationContract] double Multiply(double n1, double n2); [OperationContract] double Divide(double n1, double n2); } }

  1. How to: Implement a Windows Communication Foundation Service Contract

  2. How to: Host and Run a Basic Windows Communication Foundation Service

    Create a base address for the service.

    Create a service host for the service.

    Enable metadata exchange.

    Open the service host.

  3. How to: Create a Windows Communication Foundation Client.
  4. How to: Configure a Basic Windows Communication Foundation Client
  5. How to: Use a Windows Communication Foundation Client.

A WCF service is a construct that exposes one or more endpoints, each of which exposes one or more service operations. The endpoint of a service specifies an address where the service can be found, a binding that contains the information that a client must communicate with the service, and a contract that defines the functionality provided by the service to its clients.

<client> <endpoint address="http://localhost:8000/ServiceModelSamples/Service/CalculatorService" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ICalculator" contract="Microsoft.ServiceModel.Samples.ICalculator" name="WSHttpBinding_ICalculator"> </endpoint> </client>


Filed under: Dotnet/C#

Viewing all articles
Browse latest Browse all 284

Trending Articles