Wcf slows down after 10 Exceptions!

  • Thread starter Thread starter Michael
  • Start date Start date
M

Michael

Hi All

I wrote a Windows Service to host me TCP WCF Service. The Host and the
Service are running well. But I run a Test where I call a Service that has to
write Data in a Database. The first time everything is ok but after the first
call I create a Unique Constrains Exception on porpoise. I get the Exception
on Client side, Handel it and call the same Service again. But after the 10
times he runs in the timeout and get now more response from the Service. When
I run the same Service as BasicHTTP under IIS it works fine.
I already check if he is running in one of the Events of the ServiceHost
(serviceHost_Faulted or serviceHost_Closing) but he never shows up in here. I
also take a look in the Service Trace Files but there I get only my Unique
Constrain Exception and the Time Out Exception.

Does anyone have an Idea where I can search this Problem or how an Exception
can bring a ServiceHost in a “not answering anymore mode�

Regards Michael
 
It is always the easy stuff you don’t think of. Thank you for this really
good answer. All 3 are working but I have chosen number 2 because it fit most
in my application.
Thanks again
Michael


"Jiang Tao Liu [MSFT]" said:
Hi Michael,

I will assist you on this question.

In my experience the error means there are more 10 sessions, but the
default session limitation is 10.

The session will be increased after creating a new proxy service object. I
suppose you create a new service object every time you run it and not
release it finally, so there are 11 sessions when you running 11 times, and
brings about the error.

There are three ways to fix this issue:

1. Define the service object as an global variable:

Public class MyClass()
{
Private service service1;

Public MyClass()
{
service1=new service;
}
Public void Run()
{
service1.HelloWord();
}
}

2. Release it after calling:

Public class MyClass()
{

Public void Run()
{ service service1 = new new service ();
service1.HelloWord();
service1.Close();
}
}

3. Change the session Limited(MaxConcurrentSessions), please refer to MSDN
at :
http://msdn.microsoft.com/en-us/library/system.servicemodel.description.serv
icethrottlingbehavior.maxconcurrentsessions.aspx

Best Regards,

Jiang Tao Liu[MSFT]
Microsoft Online Developer Support
======================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from this issue.
======================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================
 
Back
Top