Using the client proxy
Hi,
I have a created a service which I expose using a netTcpBinding endpoint.
On the client side when I create an instance of the proxy, is it ok to maintain a reference to that instance for the lifetime of the client application? Or should i use the proxy once, purge the reference and then instantiate it again when I need to use it?
Thanks in advance.
Vikram
There's a lot of variables that will go into making that kind of decision.
A good indicator would be how often you actually call the service from the client, how many clients you expect to have and, of course, server resources.
If you're using security (and I'm assuming you are) then you must understand that for every new proxy object that you create and use, it will create a new security context which involves several messages to and from the server in order to establish. Usually this is pretty quick, but obviously if you can get away with creating less traffic, that's usually a good thing.
Also, if you're using sessions, then there is a session limit to consider. If you go past the limit (which is configurable by the way), your calling clients will hang while waiting for a session resource to free up.
So, really there really is no one answer. It's all about creating, tuning and testing your app for what you need it to do.
Sorry to be so ambiguous.... ;>
Thanks!
Scott
Hi Scott
That is actually a very good answer. It has set me thinking on the correct path.
Just to give you a rough idea of my usage scenario:
I am using a product called Managed XLL to create user defined functions in Excel that invoke managed code. The managed code will in-turn use WCF to invoke remote services (using netTcpBinding for performance).
So every time the sheet is recacled there will be a quick succcession of remote calls (from about 1000 cells roughly) and then there will be a period of inactivity until the user recalcs the sheet.
Regards
Vikram
Hi Vikram,
I have a MS Office development application for Excel Worksheet. I have implemented an XLL for Excel Add-in using VS 2005 C++ managed code. As usual, functions which are registered and exposed to Excel are in the table. That xll is working. It takes parameters from Excel and calculates and the result is returned to the cell where the function is called, like any other Excel function.
Now, I need this xll communicate with WCF client proxy, running on the machine. This xll will pass on parameters to WCF client and WCF client will pass on to the WCF Server to get data from the Dynamics AX.
From WCF client to WCF server on the SharePoint side is working. The problem I have is to make this xll communicate to the WCF client and get the functions which are exposed by the WCF client proxy.
The concept is pretty much the same as implemented by Vikram. I have posted a message there but have not received any reply yet.
What I exactly need is some sample code showing how add-in xll can access all the exposed functions by WCF client proxy. I will appreciate if you can kindly help me or give me some direction to follow.
Thanks,
Regards,
Martin