Attach to Process

WCF

Coworker was getting a TCP error code 10061: No connection could be made because the target machine actively refused it [closed] error, while trying to setup an application to run in IIS.

The fix that worked for us can be found here: TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:808. windows 7.

The fix was basically to check the “Windows Communication Foundation Non-HTTP Activation” checkbox under .NET Framework 3.5 in the Windows Features settings box.

Tags: #WCF #TCP

Discuss... or leave a comment below.

A few months ago, I ran into a situation where I had to increase the timeout for a WCF service call, that my ASP.NET Web API was making. It wasn't as straightforward as just adding configuration to a config file, like you would do with a WCF service. You actually have to do it in code. The answers to the stackoverflow question listed below, helped a lot in figuring out a solution for it.

Link: How to increase the timeout values for a WCF service in a dot net core 2.1 project – Stack Overflow

In your Web API code, you can create a partial class for the WCF client you are trying to call. In that class, you should be able to get to the Endpoint object. This object allows you get to the WCF bindings where you can set the timeout values. Then you can do something similar to the code I have below to set the timeouts.

TimeSpan timeSpan = new TimeSpan(hours: 0, minutes: 0, seconds: timeoutInSeconds);
Endpoint.Binding.CloseTimeout = timeSpan;
Endpoint.Binding.OpenTimeout = timeSpan;
Endpoint.Binding.ReceiveTimeout = timeSpan;
Endpoint.Binding.SendTimeout = timeSpan;

Tags: #AspDotNet #AspDotNetWebApi #WCF

Discuss... or leave a comment below.

When you just want to do a simple WCF service test, you don't need to download third party tools. You can use the WCF Test Client app that usually comes as part of a Visual Studio installation. I keep forgetting where to find it, so I'm writing it down on here to remind myself.

I had Visual Studio 2017 installed on my PC. Here is where I found the WCF Test Client app (WcfTestClient.exe):

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE

Tags: #WCF #DotNet #VisualStudio

Discuss... or leave a comment below.

A week ago I was running a test and kept running into a WCF BindingConfiguration Error. I would not allow myself to check-in my code unless my tests passed. So, I battled with this error for over an hour.

The binding at system.serviceModel/bindings/basicHttpBinding does not have a configured binding named ‘BasicHttpBinding_IXXXXXX’. This is an invalid value for bindingConfiguration.

It's your basic, run of the mill, WCF BasicHttpBinding configuration error.

I double-checked my test project's app.config file and the relevant client.config files – everything looked right. I know it was a configuration issue. The error message itself made it obvious that it was a configuration issue. But everything looked right. I didn't see any issues with the config files I was looking at.

It must be noted that it was already close to midnight at this point. I was working late that day and decided to push myself by resolving to check-in my changes before the night ends. I have no doubt that being tired and sleepy didn't help.

Anyway, after awhile I realized that the service method that I was trying to test, was running inside another service. So, in addition to the test project’s app.config file, I also needed to double-check that other service’s Web.config file. When I ran into this error earlier that night, I actually updated that other Web.config file. I added the entry it needed just to cover my bases. I didn't know then that it was the Web.config file that was causing the error.

For some reason, possibly due to fatigue and needing sleep, I didn't think about checking that Web.config file again. Out of frustration, I decided to take a break and headed to the kitchen to drink a glass of water. After hanging out in the kitchen for a bit, then listening to some good music, I finally had the bright idea to check this other Web.config file again. And there it was, a typo on the BasicHttpBinding entry I added. Can't believe I didn't check on it sooner.

Lesson learned here is to take a break whenever you're stuck with a problem. Give your mind time to rest. Chances are, your subconscious will kick in and tell you what to try next. And if the problem points to a configuration issue, with WCF, it most likely is. So, check all the config files, again.

Tags: #WCF #CSharp #DotNet

Discuss... or leave a comment below.