Service too busy error in WCF
Asked Answered
S

8

30

I intermittently get the following exception in my .Net WCF Service. "The HTTP service located at http://MyServer/TestWCF/MyService.svc is too busy."

Am I missing something here?

Am using basic http binding and have enabled WCF throttling.

<basicHttpBinding>
        <binding name="BasicHttpBinding_MyService" maxReceivedMessageSize="2147483647"
                 messageEncoding="Text" textEncoding="utf-16" sendTimeout="00:01:00" >
          <readerQuotas maxStringContentLength="2147483647" maxArrayLength="163840000"
                        maxDepth="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="16384" />
        </binding>

. . . .

<behavior name="MyWCFServices.MyServiceBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceThrottling
                    maxConcurrentCalls="16"
                    maxConcurrentInstances="2147483647"
                    maxConcurrentSessions="10"/>
        </behavior>

Will throttling help resolving the issue? Also,may i know the recommended parameter values for throttling for a high traffic web site?

Segal answered 23/5, 2009 at 1:23 Comment(0)
A
10

You could definitely try to increase the maxConcurrentSessions and maxConcurrentCalls in your service throttling behavior to the standard values of 30 or so and see if that makes the error go away. Server too busy would seem to indicate that more requests have come in than area allowed by your service throttling behavior, and they've been discarded since no service instance became available to service them within the given timeout period.

Amusement answered 23/5, 2009 at 8:46 Comment(4)
thanks for ur answer...do i need to enable throttling both at the client and server side web.configs?Segal
also,i would like to know what is the recommended value for maxConcurrentInstances parameter?Segal
Hi Steve - no need to handle this on the client - this is a server side only setting. As for maxConcurrentInstances: ask yourself how many requests from clients you want to handle simultaneously. 5? 10? How long does it take to handle the request? A good starting point might be 30 and see if a) this helps your service be more responsive, and b) doesn't overload your server. Tweak as needed after you see how it behaves.Amusement
Yeah... Check it here as well msdn.microsoft.com/en-us/library/…Tanto
A
8

My answer would be, check if the app pool is up and well?

I've seen this error occurring when the app pool has died due to exceptions being thrown that aren't caught.

Consider for example, custom config sections - having an error in there, will cause your app to fail before it's even started. Too many of these in a short space of time will kill the app pool.

Alcestis answered 17/10, 2011 at 16:26 Comment(3)
Check this first. It may "look" ok, but if you Stop the app pool from the manager, you will be unable to re-start it. To get everything going again, use "net stop w3svc" then "net start w3svc" from the command line.Mansur
Thank you for saving my sanity that was just on its way out the door.Hilde
This did it for me guys! Recycled the app pools and bingoAmorino
S
4

If you're service is running under your account (Identity), it's quite possible that you've recently changed your password--you'll need to reset it for its IIS application pool in Advanced Settings | Identity dialog box.

Siren answered 30/4, 2012 at 20:19 Comment(1)
+1 This just happened in a production environment. Very misleading error message indicating server busy. Boo. Thanks for pointing this out!Resile
L
2

It is not just the maxConcurrentSessions, it is also how long the session lasts.

If the client does not close the connection, it will remain open until it timesout. You could then hit the maxConcurrentSessions limit with very little activity on the server.

Lucid answered 23/6, 2009 at 19:58 Comment(3)
Actually, the client should not use the using statement. Clean up should be handled explicitly. See msdn.microsoft.com/en-us/library/aa355056.aspx for more details.Thundering
@Anthony, thanks for the comment, I have removed the using part. This was from 2009, when I was younger and didn't know any better :)Lucid
@AntSwift: Many people know it but don't do this though.Shunt
E
2

Make sure you check the inner exception, too; during our deployments, we disable the application pool of a WCF web service, and clients start getting this error during that time:

System.ServiceModel.ServerTooBusyException: The HTTP service located at https://ourserver.x.com/path/service.svc is too busy. ---> System.Net.WebException: The remote server returned an error: (503) Server Unavailable.

So in this case an HTTP error 503 is being (mis?)interpreted as "server too busy".

Ellingson answered 25/6, 2014 at 14:33 Comment(0)
F
1

The only source of this exception that I am aware of is if you are using sessions, and you manage to hit the MaxPendingChannels throttle,. Its default is something pretty low like 4. You could try setting it higher (128 for example), or if you just want to repro, set it to 1 and you should see it under load testing.

See here for more information about sessions: http://msdn.microsoft.com/en-us/library/ms733795.aspx

Foal answered 16/4, 2011 at 23:2 Comment(0)
P
1

I just ran into this error, and it boiled down to a simple configuration problem. I had a service up on the exact same port and same interface (mock service). I ran the service with the appropriate command line switch to run the "original" service I intended. The error went away.

Porphyria answered 17/5, 2012 at 21:25 Comment(0)
E
1

My Solution would be, Check the App.Config file, whether the service tag is there for this particular service.

eg:

<service name="MyServices.ServiceName">
        <endpoint address="" binding="wsHttpBinding" bindingConfiguration="TestBinding"   contract="MyServices.ServiceName">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8732/Design_Time_Addresses/MyServices/ServiceName/" />
          </baseAddresses>
        </host>
</service>
Eating answered 1/2, 2014 at 4:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.