Friday, 26 October 2012

WCF Service Library is independent of endpoint?


yes, once we prepare a wcf enabled library(.dll) which works for any endpoint.so i mean to say
funcationality is independent of  endpoint. this done through

Just changing the endpoint at web.config/app.config files.

like changinge: Binding, address,Contract(also)
yes we are exposing the service to client as alias name(contract alias name).

Ex:


  [ServiceContract(Name="ourservice")]
    interface IMathService
    {
        [OperationContract]
        int GetSum(int a, int b);
    }

so Clients an-aware of actual contract name(IMathService).

Adavantages:
                   client can flixiblilty to move one binding to another binding.
                   without  recompling this wcf enabled library.         
                   without distrubing the client--or--> wcf makes library as loosely copuled library.
    

as well as

single wcf service library--->
                  clients can works for multiple endpoints also(we know this with different bidnings).

Every Service require an independent hosting?

yes, Every service requires an independent hosting. and ServiceHost only the type which can host the service
which can be
 Self-host



 IIS-Hosting.
hosting can be any type but hosting class is ServiceHost.
Service name can be changed to our library contrains Servicename(wcflibrary contrains name of service).

wcfservicedemo.MathService(wcfservicedemo.dll)

code behind is can remove when implementation of service available in dll.

No comments:

Post a Comment