wcf consumer doesnt get response within the timeout limit although the service works correctly - wcf

i'm suffering the same issue as
WCF consumer doesn't get response within the timeout limit, although the service itself is done
here, timeouts are set correctly. other application like soapui are getting response back from server on the same client.
also not getting any error, just wait until timeout is reached, this is on a Windows 2019 with IIS 10. Client is a win32 application on Windows 10. When connecting to windows 2008 it is getting the right response
I managed to rebuild the dll's on .net 4.8 but no difference on the response.
Any help ?

Related

WCF Service: Status 200 with sc-win32-status of 64

We observed the following behavior on one of the servers hosting a WCF service on IIS 6.0:
The IIS log shows a high value for time-taken (> 100000)
The HTTP status code is 200
sc-win32-status code shows a value of 64
I found out that sc-win32-status code of 64 indicates "The specified network is no longer available"
Initially I suspected that it could be because of limits set on MinFileBytesPerSecond, which sets the minimum throughput rate that HTTP.sys enforces when sending data from the client to the server, and back from the server to the client.
But the value for sc-bytes and cs-bytes indicate that the amount of data is sent is within the range generally observed for the service.
Also note that the WCF service is hosted on four boxes and is load-balanced, but the problem occurs only one of the servers. (but not essentially on the same server). The problem is also intermittent.
Has anybody else encountered this error? Any clues about what could be wrong?
Update
Note: Observation on IIS 7.5 (IIS version does not really matter)
I was able to replicate the issue. The issue occurs if:
1. The WCF service takes a long time to respond
2. The client proxy times out before it receives a response from the server. In this case it leads to TimeoutException on the client.
3. The server keeps waiting for TCP ACK for the client, which it would never receive.
Hence a long timeout (TCP socket timeout (default value: 4 minutes) and sc-win32-status of 64
So essentially it appears that WCF code is taking a long time to respond and the client is timing out, what I observe in IIS log is just a symptom and not a problem.
The behavior you are describing will also occur if you exceed a WCF service's max sessions, calls or instances (depending on how you have your service instancecontext mode configured). If you observe the System.ServiceModel performance counters for %max concurrent sessions and/or %max concurrent calls (again depending on your service's instance context), you may see a correlation with the IIS log entries.
Note that these maxes can be configured in the service throttling behavior.
https://msdn.microsoft.com/en-us/library/vstudio/system.servicemodel.description.servicethrottlingbehavior(v=vs.100).aspx
I saw your question again and wanted to point out that I found a solution for this. It turned out to be this piece of code in the web.config:
<pages smartNavigation="true">
After turning this off I stopped receiving the same time-out errors. See also the answer here
IIS put the services into sleep to save recources.
Copied from here (WCF REST Service goes to sleep after inactivity)
The application pool hosting your service defines Idle Time-out property (advanced settings of app pool in IIS management console) which defaults to 20 minutes. If no request is received by the app pool within idle timeout the worker processes serving the pool is terminated. After receiving a new request the IIS must start the process again, the process must load application domain and all related assemblies, compile .svc file, run the service host and process the request.The solution can be increasing idle time-out but the meaning of this time-out is correct handling of server resources. If the process is not needed it should be stopped. Another ugly workaround is using some ping process (for example cron job or scheduled task on the server) which will regularly ping call some method on the service or page in the same application.

request timed out for WCF service using nettcpbinding

I am new to WCF services, i have created a sample WCF service, where i have Hosted WCF Service with netTcpBinding in Windows Service.(since i want this WCF service to run as windows service)
Its a simple service which adds/deletes/loads employee details, and is consumed by a windows forms application.i don't know why, only 10 requests are responded, no matter what you do.The 11th request gives an error "request timed-out"
i know that increasing the time-out time wont help, it would just make me wait longer for that error.
i also know that my server(currently-local pc) is not responding for the 11th request, but don't know the reason.
Is there any setting for number of request/responses per minute for server? might sound funny, but i have no idea.
More useful info on the issue:
Can't change the binding other than nettcp (system requirement)
Logged in as Admin
Firewall disabled
It sounds like the connections aren't being closed - the default limit for WCF connections is 10, so the 11th won't work.
It might be that you're not explicitly closing them see here:
http://devcatharsis.blogspot.com/2008/09/wcf-refusing-connections-after-10.html
http://geekswithblogs.net/marcel/archive/2007/05/01/112159.aspx
Hope this helps.

NT Hosted WCF Service With MSMQ fails to stop cleanly and Locks Up

This is a problem which has had me baffled for weeks now on a client's Live environment.
The WCF service is hosted on Windows Server 2003, and has both HTTP and MSMQ endpoints.
When placing the service in the test environment, the service cleanly starts and stops, and messages are passed without problems. However on the Live environment, the service starts fine, but does not exit cleanly.
When attempting to stop the service, the machine takes a long time to respond and eventually displays an error saying that the service could not be stopped. Inspecting the error on the event log, it says that it was unable to write to the MSMQ queue (access denied), however, the service is able read and remove messages from the queue. If one then refreshes the service manager, the service is in fact stopped.
The MSMQ queue is hosted on a different physical machine, and we have been unable to reproduce the error on the test environment.
We are not sure if it is related or not, but the service will also occasionally stop pulling messages from the queue. This has been solved by restarting the service. Again, we have not been able to reproduce the error.
Recently we experienced another error with the HTTP based client where upon midnight one night, the service suddenly started rejecting connections with the following exception:
The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'. ---> System.Net.WebException: The remote server returned an error: (401) Unauthorized.
Even more curious, is that simply restarting the service seems to correct the problem.
If anyone has seen anything like this before or has any comments, it would be much appreciated!
Speaking to a colleague, apparently setting the ServiceModelEx throttling options all to "1" help with the lock ups on MSMQ based WCF services.

WCF SERVICE gives us faulted response

My service is hosted on IIS7, windows 2008 server with sql server2008 express.
I am getting following error when the process takes more than 2 minutes i got this response, i m unable to find out either it is due to sql server time out or wcf time out. my sql server process is also took long.
An error occurred while receiving the HTTP response to http://REMOTE/SynchronizationService_test/SyncService.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.
I guess the best thing to do is to look through the server logs, as the message suggests.
Learn how to configure WCF tracing: http://msdn.microsoft.com/en-us/library/ms733025.aspx
I have set the mode of service singleton and it works for me.
And also set configuration Throtling of WCF behaviour.

WCF Service polling hangs

I have 2 wcf services, 1 which polls the other service at regular interval.The service2 is hosted in no. of machines with the same configuration.
My problem is that whenever the poller service gets restarted, even though the service2 on other machines runs fine, i am not getting the response from those services (basically it gets timed out - getting SYSTEM.TimeOutException ). If I try to access the same service (service2) from some temp application (without restarting the service2) it gives response.
If I restart the service2, than it works fine, the service1 (poller service) gets the responses from all hosted services (Service2).
Dont know what is causing problem.
Regards,
Chirag
Attach VS to your wcf service which hangs. And find out if your connection is successful.
Do it with both services, so that you can debug the services at runtime.
If you're using a sessionful binding (netTcpBinding, wsHttpBinding), it's more than likely that you're not explicitly closing your client channel when you're done with it. This would cause the behavior you see, because the session takes a minute or so to time out if you don't explicitly close it, and the default max number of sessions is low (10)- the server will let new sessions stack up until old ones close. You can also adjust the service throttle on the server side binding to increase the max number of open sessions allowed, but you really should make sure your clients are getting cleaned up properly first.