System.ServiceModel.CommunicationException on overloading webservice - c#

I am load testing my webservice
and get a
System.ServiceModel.CommunicationException
when I use 10 threads to communicate to it (without any sleep in between) - basically testing 10 conenctions at a time - through a windows application
An error occurred while receiving the HTTP response to http://localhost/XXX/XXXService.asmx. 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.
Why would this happen and how to best resolve it
Also is this the way how asp.net application will interact with it too - is threading the best way to do the load testing

To begin with, you might want to try using WCF for new web services development. Microsoft now considers ASMX web services to be "legacy technology", and suggests that all new development use WCF.
Next, you might want to find out what happened. The exception isn't lying to you. There was an HTTP protocol error. You could look at the network traffic using Fiddler, to see what the problem is.
You might also look in the server event log.

Related

Azure function c# .net throws 502

I am having consumption plan in azure, do not have any gateway or proxy setup.
While testing I got this error also its not logging in my app insights, it neglects that request, as like it did not reached/requested to it.
How can fix this ?
502 - Web server received an invalid response while acting as a gateway or proxy server
Cause:
This problem is often caused by application level issues, such as:
1.requests taking a long time
2.application using high memory/CPU
3.application crashing due to an exception.
Steps:
1.Observe and monitor application behavior
2.Collect data
3.Mitigate the issue
Have a look of this Offcial doc.

WCF on IIS incoming "invisible" requests issue

this time I have a particular question.
I have a WCF exposed in our server. If you just call it from the browser, you can see the wsdl, so it is working.
Our partner has to call this WCF with a soap request (old, but this is a requirement). We don't see any request from their network, also in the IIS log.
Now, they told us our service returns "java.io.IOException: Async IO operation failed (3), reason: RC: 107".
I'm quite surprised, since, first of all, we wrote the WCF in C#, of course not Java. Further, how is it possible they send a request but we don't see it neither in the IIS log?
The error
java.io.IOException: Async IO operation failed (3), reason: RC: 107".
Is the error their client is throwing.
This means that the client call doesnt reach your endpoint.
There is very likely a network connection issue along the way.
Eg a firewall blocking the port , or blocking the origin of the call etc.
Some routing problem etc...
You may need to get a network guy to track why their call doesnt reach the your WCF service.

CommunicationException; Store App -> .NET 4.5 WCF Duplex TCP Service; Instant Timeout

I am having trouble getting a Windows Store App to make calls into a WCF service.
The service is a Duplex service using a netTCP binding. The first time the client (A Windows 8.1 Store Application) uses the service, it throws an exception:
An exception of type 'System.ServiceModel.CommunicationException'
occurred in mscorlib.dll but was not handled in user code
Additional information: The socket connection was aborted. This could
be caused by an error processing your message or a receive timeout
being exceeded by the remote host, or an underlying network resource
issue. Local socket timeout was '00:09:59.9968452'.
This timeout is near-equal to my max, 10 minutes. The exception, however, happens immediately, and breakpoints in the service function are never hit. The two do seem to be talking at some level because altering the security protocol or the endpoint address cause other exceptions (security and connection as you would expect). I put a breakpoint in the service and the function I am trying to call never gets hit.
I have tried:
Ensure feature equivalence between Service and Client NetTcpBinding configurations
Raise timeouts, sizes (1-10 minutes for each, 10000000 for max sizes)
Ensure all passed object types are DataContracts with default constructors
Prayer; Considering a burnt offering
Any help would be greatly appreciated. New to WCF and having trouble finding help for the Windows Store / netTCP / Duplex targeted scenario.
If your Windows Store App client and WCF service are on the same computer and you're not running the Windows Store App client from inside Visual Studio, then you need to enable loopback communication. Check out this article:
http://msdn.microsoft.com/en-us/library/windows/apps/dn640582.aspx
At the very bottom it talks about the command line utility:
checknetisolation
Also, try making your method call as simple as possible with no return and no arguments. I know you said you checked all of the 'DataContract' attributes. But things can get tricky such as if you're using polymorphism and the base class doesn't have a 'KnownType' for a derived.

Is the SilverlightFaultBehavior class required for Silverlight 4?

MSDN says
Silverlight version 4 enables support for the Windows Communication
Foundation (WCF) SOAP fault programming model, which allows the
service to communicate error conditions to the client. In previous
versions of Silverlight, if an error occurred on the service, it would
register as an HTTP 500 response code and details about the error
would not be accessible to the Silverlight client.
However a number of other locations suggest using this still for Silverlight 4 clients and the above seems fairly ambiguous on what to do for Silverlight 4. I was wondering if anyone could confirm what approach should be used for handling WCF errors on Silverlight 4.
Yes, if you want to catch faults in a Silverlight 4 client, you will need to use a custom WCF behavior that changes that HTTP status code from 500 to 200 when a fault is raised by the service.
See: http://msdn.microsoft.com/en-us/library/ee844556(v=vs.95).aspx
There are two HTTP stacks in Silverlight, one provided by the browser (the default one) and a client stack, which is one written using the native OS stack. If you use the first one, you need to use the fault behavior to convert from 500 to 200 in the service. But if you use the client stack, you should be able to consume "normal" faults in SL.
More information about this at http://blogs.msdn.com/b/carlosfigueira/archive/2009/08/15/fault-support-in-silverlight-3.aspx.

Examples of long-polling in ASP.NET combined with WCF service monitoring?

We have a number of Windows services running in our system (built in C#). We use WCF to communicate with them and control them, since WCF offers very convenient communication with these processes.
Right now in our Windows GUI for managing, monitoring and troubleshooting the services, we simply register callbacks and receive notifications when a message is available from the service. Obviously this application is stateful and WCF provides the ability for the local delegate to be called when the maintained connection to the service indicates.
In our web application which users actually use, we'd like to use long-polling to have a status area on the web page (iframe, AJAX, whatever) which shows any issues which the services are reporting. We'd like to use a long-polling or other technique which minimizes actual polling on the network.
The problem we are running up against is that we need something to make the long-polling HTTP request against which will somehow always be running in IIS and which itself can be WCF-connected to our services and which can convert the event/delegate-based WCF response into a blocking-style long-poll response. It feels like a chicken-and-egg situation that some component in our system is always going to be in a loop, polling - and that's exactly what we are trying to avoid.
Does anyone have an example of doing this?
Well, if your services present with WCF, why not simply consume the WCF services with javsacript? Then you remove your IIS servers from the equation completely. if a user wants to see what the services are doing then they can retrieve the information directly from the service.
Here's a blog with someone showing how to do this:Call wcf service from Json

Categories

Resources