I'm researching what is the best way to create a generic WCF proxy wrapper
that has the following requirements:
1. Remove the System.ServiceM odel config section requirement for clients. We
have our own configuration management that follows our application lifecycle
(development/system test/production). Also, most of the proxies we build are
for the middle-tier layer.
2. Create a wrapper to follow WCF Client best practices (proxy.close &
exception handling). My thought was to use the "Using" statement for
resource cleanup. (But I found another article that states otherwise :
http://msdn.microsoft.com/en-us/library/ms733912.aspx)
3. In some scenarios, adjust binding security as required by an
application/service.
4. In most scenarios, we do not want to expose MEX/WSDL of the service, with
the exception of Development.
I have found numerous articles that discuss this particular topic. Based on
my knowledge of WCF, there are two ways for a client to call a WCF service...
1. Add a Service Reference.
2. Dynamically build the proxy based on the WSDL.
Basically, that leaves option 1 (due to requirement #4). With that said, I
found two different approaches of calling WCF services…
1. Use the ClientBase<TCha nnel>
2. Use the ChannelFactory< TChannel>
After researching the topic, I’m leaning toward option 2 and found numerous
samples on the Internet. However, I do have a question about what to cache
for performance. Most articles said to cache the proxy and reuse it as much
as possible. But, according to some articles I found, if you have to change
the binding, for example, you shouldn’t cache (Create, call, and close the
connection). Is this referring to the proxy created after calling
CreateChannel on the ChannelFactory class?
Any guidance would be most appreciated.
Thanks
--
Mark Remkiewicz
Systems Architect
that has the following requirements:
1. Remove the System.ServiceM odel config section requirement for clients. We
have our own configuration management that follows our application lifecycle
(development/system test/production). Also, most of the proxies we build are
for the middle-tier layer.
2. Create a wrapper to follow WCF Client best practices (proxy.close &
exception handling). My thought was to use the "Using" statement for
resource cleanup. (But I found another article that states otherwise :
http://msdn.microsoft.com/en-us/library/ms733912.aspx)
3. In some scenarios, adjust binding security as required by an
application/service.
4. In most scenarios, we do not want to expose MEX/WSDL of the service, with
the exception of Development.
I have found numerous articles that discuss this particular topic. Based on
my knowledge of WCF, there are two ways for a client to call a WCF service...
1. Add a Service Reference.
2. Dynamically build the proxy based on the WSDL.
Basically, that leaves option 1 (due to requirement #4). With that said, I
found two different approaches of calling WCF services…
1. Use the ClientBase<TCha nnel>
2. Use the ChannelFactory< TChannel>
After researching the topic, I’m leaning toward option 2 and found numerous
samples on the Internet. However, I do have a question about what to cache
for performance. Most articles said to cache the proxy and reuse it as much
as possible. But, according to some articles I found, if you have to change
the binding, for example, you shouldn’t cache (Create, call, and close the
connection). Is this referring to the proxy created after calling
CreateChannel on the ChannelFactory class?
Any guidance would be most appreciated.
Thanks
--
Mark Remkiewicz
Systems Architect
Comment