Nested WCF service calls get stuck in IIS - c#

I have a case where I have to send calls to other service methods from a service method. e.g. I call a service method A.Call1() from my smart client application, then after some operations it sends call to B.Call2() and then Call2 method sends call to C.Call3().
When I send few concurrent hits to A.Call1() then all service methods stuck in IIS most of times and times out, anyone suggest a fix or better design.
I'm using simple HttpBinding, 4.6 .Net Framework with IIS 8.5 and using default throttling settings.

Related

Service fabric container not allowing http/s calls to extrnal API's

I'm busy creating some microservices using the Service Fabric mesh, and these services will be making some calls to external API's.
Im using .net core 2.2.
My interservice communication works fine, all the services can talk to one another, but when i try and make a call to an external API, one thats not hosted on my machine, the connection cannot be made and the call fails.
I have check in Fiddler 4 and i don't see any traffic to the urls i'm trying to call, this happens for both HTTP and HTTPS calls, GET and POST.
EDIT
I'm behind a proxy, and it feels like this could be the reason.
Edit 2
I have determined that this is due to our proxy, when connected to a personal connection, the calls work properly.
Although, when i run the same code and tests froma normal cmd app and not from within a conatainer the call works.
How do i get around this?

Calling wcf service from another WCF service hangs the call

I have several services running. I can call everyone from a client application. I am trying to call into one service from another service (same application - they are hosted in an application for testing but can also run as a windows service).
The call I use to do this from the client is simply create the factory and CreateChannel and then open.
When I do this in a service trying to connect to another service I don't get an error it just hangs and eventually times out. I have no idea what is wrong.
I am using net.pipe://localhost/test as my endpoint and transport.
This was really stupid but (and) I will post the issue to help others that may run into this...
All of my service was running single threaded so when I called into another service it was blocking itself. I now start my threads on backgroundworker threads and the issue is gone.
Thanks

WCF initialization slow vs .NET Remoting

I'm trying to migrate a .NEt Remoting app to WCF, right now both services(Remoting and WCF) are living together.
I have one client consuming both of this services at the same time and I noticed that in the very first call to WCF service it takes a little bit longer than the first call to .NET Remoting service.
With .NET Remoting service the first call get response almost immediately.
.NEt Remoting first call response time: less than a second.
WCF first call response time: about 2 seconds.
I know that there is some initialization cost for WCF connection to be opened, but how can I accelerate this WCF channel wakeup time ??
Any hint?
WCF is doing so much more than remoting. There is a cost for this work. Full stop.
Try calling the WCF service before you need it. Consider adding a Heartbeat() or Init() method to the service to trigger the startup process. If the startup is completed by the first call, there should not be a delay for subsequent calls.
If you have the option to host in AppFabric then you could use the Auto-Start Feature which is specifically designed to get the application initialized before the first client call.
Benefits of the Auto-Start Feature
When you enable the auto-start
feature for a service, the service is up and running as soon as the
application that it belongs to is started and before the service
receives the first WCF message from the client. Therefore, the service
processes the first message quickly because it is already initialized.

How to fire-and-forget in WCF when using wsHttpBinding

I have a WCF service hosted in IIS and it is consumed by an ASP.NET application. Service and client are on diferent servers and communicate over internet.
Message security over wsHttpBinding is used as the security model (using X.509 certificate).
I tested the service with Fiddler and everything seems OK unless for a single call there are 4 sessions in fiddler (two round-trips). I don't need sessions with WCF and want my calling threads (which are asp.net worker threads), not to be blocked when calling a WCF method.
How can I achieve fire-and-forget pattern when using a WCF service (I can change the service contract if needed) ?
Fire and forget (One-Way operation) only says that your operation doesn't return any result and so client doesn't have to wait for server processing. But it has nothing to do with infrastracture calls you see in fiddler. First of all turn off estabilishSecurityContext and negotiateServiceCredentials in your security element (these are turned on by default) and try it again.
I assume that when you say "fire-and-forget" you are referring to a web service call that yields no return parameters. WCF has the notion of One-Way Method invocation that might help you here.

calling a WCF service object method in another WCF service

I using two WCF services. WCF service A is hosted in my .NET Winform application and WCF Service B is hosted on a Windows Service.
I am able to instantiate a client for WCF Service B and use the methods - i.e. call the WCF service hosted on Windows service from the .NET Winform app.
I am not able to accomplish the reverse with WCF Service A - i.e. call the WCF Service hosted on the .NET Winform application from the Windows Service. The call to the method times out.
I have used the WCF Test client from the Visual Studio command prompt and it can successfully make calls to WCF Service A.
Is this due to a security issue or something from the Windows Service?
Please advise.
Thanks in advance!
Subbu
I think the only viable approach (without the extreme of having some messaging infrastructure), is to have the service invoke operations back on your client via a WCF callback. A good example of this can be found here:
What steps do I need to take to use WCF Callbacks?
This is good for dealing with events that happen server side and allowing the client to respond to them. If events isn't what you're looking for, then your client could just register with the server (specifying the callback contract), and then the server can invoke your client at will.

Categories