When your WCF service stops responding

by Matthew Noonan 19. February 2008 00:00

My venture into WCF is proving to be quite educational, in some ways more stressful than others. Today I had a client trying to run a demo, but their service calls were routinely locking up and they kept having to restart the web server. So much for having a day off...  :-(

So I drove to the client, fired up my WCF test harness, ran a couple of tests and everything seemed to be working just fine. So I loaded up the AJAX-driven web site, and sure enough I could make the service lock up after just a few callbacks to the server. Back to my test harness, only this time I decided to add some looping in order to simulate the multiple calls made by the web browser. This time, I was able to lock up the service in my test harness as well.

So what was the solution?

It turns out that when you create the proxy for the service call, it is very important that you also call Dispose(). I guess I got a little lazy and tried to count on the garbage collection to take care of it, but my code was actually starving the service pool of available threads, and so it stops responding until the web server is restarted or the application pool cycles.

So I'm posting this here hoping that others will learn from my mistake: make sure you call Dispose() directly on your service proxy object, or use the "using" statement which will do it for you automatically.

 

HelloServiceClient proxy = new HelloServiceClient();
string result = proxy.HelloWorld(textBox1.Text);
proxy.Close();
proxy.Dispose();
 

-- OR --

 

using (HelloServiceClient proxy = new HelloServiceClient()) 
{ 
    string result = proxy.HelloWorld(textBox1.Text); 
}

 

In my next post, I will review the WCF support now in EasyObjects. Way cool.

kick it on DotNetKicks.com

 

Tags:

WCF

EasyObjects.NET Roadmap for 2008

by Matthew Noonan 12. February 2008 23:43

As I said in my last post, it's time to stop waiting around and move on to something better. And 2008 should be a great year, so it's time to get going!

First things first, and that's to get going on the beta testing for Access, MySql and Firebird I announced last year. There have been a few volunteers, but not as many as I hoped. I attributed this to the fact that I chose the holiday season to make the announcement, but it's February now. So I am emailing the people who asked to test and sending them a full copy of the current build of EO2 (not the free build) and the associated database modules.

Once that is underway, my next crucial task is to get the EasyObjects Store up and running. I have the basic web site ready, an SSL certificate and PayPal integration set to go. So after some testing, my goal is to have the store online before the end of Q1. The initial version of EO2 available for purchase will be a beta, but any purchases will entitle the user to free upgrades to all beta releases and the full EO2 once it becomes finalized. There will be no support levels available until after release, because that is all still under consideration.

The next big enhancement for EO2 is coming from a project I am working on, and that is WCF. I have modified the templates to generate the Operation and Data Contracts, as well as some lightweight, serialize-friendly classes to help EO work with WCF. It's still in the early stages, but WCF is too cool a technology not to support in EO. Target for a beta release is Q2.

For Q3 and beyond, there will probably be a new release of the Enterprise Library to deal with, we will finalize support for the new database modules, and finally a full release of EO2 in the Store.

That's my current plan, which will promptly go to shit faster than I can blink an eye, but at least it gives us some goals to shoot for.

I welcome your feedback.