Intermittent WCF Connection (There was no endpoint .. ) error - wcf

I have a WCF service hosted in the IIS (IIS 8). The service is in a Per Call Mode and the concurrency mode is set to Multiple. I have around 600 clients connecting to it. It has a HTTPS end point. It also has a net.tcp endpoint but that is not used. Not all but some of my clients face a very weird problem. The client stops working after using for a while. I have error logging and at the client side I see the error which says
There was no end point listening at ...
There are no errors on the server, or the service. The service seems to be working fine. I can browse to the service page from a browser and other clients are still able to use the service. Running a trace is also not helping. I have spent enough time trying to figure it out but with no luck. Further more, on the same computer just restarting the client seems to work and connect to the same service. The client is a WinForms Application.
I performed a DNS flush on my machine and even that does not help.
What could be the possible issue? The things that hit my mind are that maybe the client is unable to resolve the name, but that is contradictory to it connecting in the first place.
The service maybe down, but my other clients are still using the same and they do not face problems.
It might be a problem with the client machine as it Uses Win XP but I am not sure if that would cause a problem.
Or it might be a problem because of intermittent internet connection.
Has anyone ever faced such a problem before? Some insight would be really helpful

IIS can only serve a limited number of clients at a time. It will then place additional requests onto a queue. That queue is also limited. When that queue fills up then IIS returns a 500 error, which is interpreted as "There was no end point listening at ..."
You should try this piece of code.
public void Main()
{
while(thereIsStillThisProblem)
{
var pc = new Pc();
pc.OS = new Windows2012();
pc.Start();
pc.Software.Add(new ServiceHost());
}
}
http://www.microsoft.com/technet/prodtechnol/windowsserver2003/library/iis/64e30660-d2f0-4e90-98cc-1652214a2b93.mspx
Edit: Just remembered that there is one more thing you can do, if you are using .net 4.5. I will let Jon Skeet explain.

Related

WCF 4.0 Service crashes

I have wcf service hosted in iis 7.0.
It was working well for the past year, but now suddenly it's crashing and restarting every few minutes.
I looked at the trace file, and I see the error but I don't know what it means. I tried googling it but no luck. I checked the settings in IIS. It looks ok.
This is how my trace looks like. If someone can help me understand this trace, it will be good.
This are pure assumptions, but as far I guess by looking at your traces and what you wrote:
You are using a net.pipe WCF host
The endpoint address of your host is net.pipe://tstwebashitv... something, so you are not using a the net.pipe://localhost/... format (assuming tstwebashitv is not a server name, and your net.pipe is not remote)
The service used to work for a long time
So I assume there is a possibility that another named pipe WCF host is running on the same machine, and might cause conflict.
That's why I suggest to check those points:
Have net.pipe endpoints adresses under this format: net.pipe://localhost/something instead of net.pipe://something.
Check HostNameComparisonMode setting in the NetNamePipeBinding section : it is better to set it to Exact to ensure running hosts receives messages addressed to them.
Basically, if the HostNameComparisonMode is not set, then the StrongWildcard default mode is used and the host name in the net.pipe address is discarded.
If you have a net pipe address set as 'net.pipe://something', then "something" is considered as a server name and is discarded. So several host running that way could conflict together.

Error 503 with WCF service

I've got a self-hosted WCF service listening on port 80. When I attempt to connect to it, I get a 503 Service Unavailable.
My WCF process is running, IIS is running. My URL ACLs are correct. Control never reaches my WCF process.
WCF tracing shows nothing more than:
Listen at 'http://localhost/Foo/Bar/'.
Nothing is shown in Failed Request Tracing, which is turned on correctly -- other tracing appears. The 503 Service Unavailable message is resolutely plain, implying that it's coming from kernel mode, rather than user mode.
I've turned on HTTP.SYS tracing, which shows that the namespace is reserved correctly:
Attempted to add URL (http://localhost:80/Foo/Bar/) to URL
group (0xFD0000014000002E). Status: 0x0.
But later, in the same trace, I see:
Request (request ID 0xF600000580000006) rejected
due to reason: UrlGroupLookupFailed.
I've tried iisreset a couple of times, but it doesn't help. I've also rebooted the PC; same problem.
What is going wrong? What else can I do to further debug this problem?
Updates
If I rename the URL (changing "Foo" to "Fizz", for example), then it works. Looks like corrupted configuration somewhere.
I have other services hosted in the same process that are bound to https://localhost/Foo/Bar/, and they appear to be working correctly.
It's not just WCF
I've had the same problem with a self-hosted Nancy service, and one of the commenters, below, reports the same thing with a self-hosted ServiceStack service.
Had the problem again. Poked around with URL ACLs. There were a couple of URL ACLs that could be considered to be ambiguous.
I had http://+:80/Foo/, http://+:80/Foo/Bar/ and http://localhost:80/Foo/Bar/. I deleted all except the 'localhost' one, and it started working.
Whether it was because of the ambiguity, or because deleting the extras caused something to be reset, I don't know...

Delphi / WCF SOAP connectivity and Virtual Machine (VMWare) settings

I've got a working WCF service and a working Delphi client. On a normal PC, they work nicely. On a VM that's "Bridged" they work nicely if I log onto the domain (but not if I logon locally to the VM as administrator). If the VM is NATed, the connection attempt times out.
I would love to hear people's thoughts on what could be making such a difference to whether the client can successfully connect to the WCF service. Bear in mind I'm connecting with basicHttpBinding with no security.
The service is setup to use System Account (interact with desktop is NOT checked), and it starts automatically. The service URI doesn't change, the port is open, and can be telnet'd to in all scenarios.
Any ideas or pointers?
Within the VM, open Internet Explorer and verify that you can view the WSDL of the WCF service. If you can't, then your issue is connectivity and has nothing to do with your Delphi code.
Group Policies and Enterprise Security solutions that swap certificates or require certificates to be registered (we're using a UTM called CyberRoam) make a difference.
Also when Virtual Machines join a domain, their ComputerNames are added to a list maintained by the Domain Controller. When the same Virtual Machine is "moved" or "copied", its ComputerName should be changed to avoid DNS resolution issues.
I'm not claiming this as the definitive answer, however it does explain the issues I noticed in this instance.

Expose WCF service cannot retrieve object through windows firewall

I built a WCF service that exposes itself for a web application, it accepts an object and prints the data on the clients machine. Works fine on my development machine, and the service is up and running on any machine i install it on. I can enter ip address in clients machine web browser and see it is running. Problem is when i send the object to the clients machine it returns an error, that sounds like it could be because of the clients windows firewall. Where would i start at to deal with this problem ?
There was no endpoint listening at http://192.168.1.168:2202/PrintLabel that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
And the InnerException: Unable to connect to the remote server
With further research and discussion with people in the community i came to understand that as was mentioned at the bottom of this article.
"Self-hosted HTTP addressing for WCF is not integrated into the Windows firewall. An exception must be added to the firewall configuration to allow inbound connections using a particular URL.
But this SO question led me to a page with how to control Windows Firewall through code to enable my WCF self hosted service to accept an object.
This the link below.
http://www.shafqatahmed.com/2008/01/controlling-win.html
That link was towards the direction i needed, but based on user comments it seemed to have some bugs. A colleague found this link and i believe this technique will be the best solution for this scenario.

How to: Avoiding Cold-Start issues with IIS hosted WCF applications?

We have a system where we host a couple of WCF applications in IIS. Some of these applications have a bit of an extended start-up time taking a couple of seconds (more than a users would be happy to wait for). Once it's up and running, everything is snappy though, so it really is only the startup time.
The client also has a requirement to recycle the application pools every night.
Is there some way to wake all these services up so that the start-up time is not an issue for the first user of the system?
Initial thoughts where to write a windows service that would simply call a lightweight method on each service every x (configurable) minutes to keep the apps alive, but since we are in a load balanced environment, and the applications need specific host headers to be passed, we would always hit the load balance address which means there is no way for us to make sure that all services on all boxes in the cluster are actually started.
Since a single wcf application in IIS can only have a single host header, the only other way would be to setup a second iis web site pointing at the same application. I'm just not sure if that would do the trick since it would be in another host context.
another option could be to wright something like an extension to IIS (not sure if this is possible yet) that could call each of our services when IIS or the app pool actually starts up again. (Something that notices when the app pool has recycled but before the first user request.
Any ideas would be much appreciated.
Thanks
Gineer
Excellent. Thanks Dercsár.
After a quick Google, I found the following arcticle on the subject: Using the IIS Application Warm-Up Module
The limitations here are that this is only available on Windows 2008 R2 with IIS 7.5. Although our client is in the process of upgrading to Win 2K8R2, this may still be some time off.
Does anyone know of a solution that would work for Windows 2003 with IIS 6 or will we have to write something do make this work?
Gineer
For those of us running on a version of IIS before 7.5, we are in the process of testing the following solution...
As mentioned in the original post, the initial idea was to fire off a WebRequest from a service running on each machine to the local web sites (which host the WCF services), but this would be impossible, since they all make use of Host headers, and they all live in a Network load balanced farm.
We then thought that we could simply provide the custom host headers in the web request to the localhost.
Turns out you can not update the host header name in a WebRequest. It’s a Read only field.
Messing with a proxy class makes it work though.
See: http://social.msdn.microsoft.com/forums/en-US/netfxnetcom/thread/1b35c665-fe32-4433-8877-a62f2d400a8e/
And a short piece of my test code below in C#.
WebRequest req = WebRequest.Create("<Correct Host name>");
req.Proxy = new WebProxy("127.0.0.1");
StreamReader stream = new StreamReader(
req.GetResponse().GetResponseStream());
StringBuilder sb = new StringBuilder();
String LineString;
while ((LineString = stream.ReadLine()) != null)
{
if (LineString.Length > 0)
sb.Append(LineString);
}
stream.Close();
String response = sb.ToString();
This may not be what the proxy class was intended for, but it seems to work either way.
Gineer
Ps. No, you do not need to have any actual proxy server installed on the local host machine.