What are WCF Proxies and what are they good for?

孤街醉人 提交于 2019-11-30 04:13:44

A proxy is an in-process representative of an out-of-process service. You call the proxy (which is easy), which setups up the communication channels etc. and talks to the remote service (which is hard).

See also http://msdn.microsoft.com/en-us/library/ms730144.aspx.

A WCF proxy is really just a level of abstraction. You code against the proxy (ultimately an interface which is a service contract) without needing to work with the fine grain detail of dealing with the WCF communication logic. The benefit of WCF is that you can use many types of communication with the service (http, wshttp, msmq, named pipes etc) with the same proxy.

Technically speaking Proxy is CLR Class that exposes single CLR Interface which represents the Service Contract.The proxy provides same operations as ServiceContract , but also additional methods for managing the proxy life cycle and the connection to the service

                           or

Proxy is use to Represent the ServiceContract Interface in Server from client side.By using proxy we can invoke service methods which Present in Interface which lies in Server.

Client proxy is required to consume WCF services from .NET clients. Proxy is an object in memory on the client-side that exposes the same Interface or API that the WCF service does. Your consuming code will make calls against that proxy and proxy will dispatch those calls as SOAP Messages to the WCF service.

Proxies can be code-generated by Visual Studio based on the metadata exposed by the WCF service either in WSDL or WS-MetaDataExchange endpoint(which is SOAP based).

If you want more control over service consumption then you can hand-code proxies. Like you want to encapsulate the repeating pattern of usages e.g setting up credentials etc.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!