Restart a WCF service after a server reboot - wcf

Is there some mechanism in WCF that can be used to "pre-start / warm-up" WCF services that are hosted in IIS ?
- something like the warm-up scripts for SharePoint sites
I have the situation where servers are re-booted over night and next day there is a long delay while the WCF services spin-up. I can't change the time-out in various applications that use the services, so the first users are reporting errors in the morning when they go to use their applications
This is on Windows 2003 Server and IIS 6.0, so the IIS Application Pool Warm-Up Module, http://www.iis.net/download/applicationwarmup, as that's for IIS 7.5
NOTE: the module seems to have been temporarily withdrawn, see details on ... IIS Forum

I know you will don't like the answer and I think I repeat myself because it is not the first time I'm posting it. The way to warm-up anything in IIS prior to version 7.5 is using scheduled console application to ping your web site / services and warm them up. It is ugly solution but it works, it is easy and I saw it on every project which had to deal with this requirement.

WCF services should be instantly ready when they start. Just make sure the services are set to automatically start when the server boots.

You can use Windows Server AppFabric, it has Auto Stat feature to keep the service always on. But you need to be on IIS 7.5 to install App Fabric.

Related

Hosting of WCF and Windows Services

My head hurts so much I think I need a bottle of aspirin...
I've created a WCF service and, with help of others from this site and the department I work in, the WCF service is running as a service on my development machine. Tested it with a console app and it works.
But, it's not supposed to be on my development machine. It needs to be on a different server.
This is difficult because the server it is supposed to reside on DOES NOT have Visual Studio installed on it.
So I cannot run the VS 2008 Command Prompt with installutil to run the WCF service as a service on that server.
Broadly speaking, you've got three options, all of which are described on MSDN:
Host the service under IIS
Self-host the service in any managed .NET application
Host the WCF service under a Windows Service
Which one is right for you depends on what your service is for, how it'll be consumed, how scalable and secure you need the set-up to be, and a dozen other things besides. Without knowing a bit more about what your service does and how it'll be used in your organisation, it's difficult to make a recommendation.
IIS hosting is easy to set up and is the way to go if you want to leverage all of the industrial-strength hosting functionality that a full-blown web server offers.
Self-hosting is quick and easy - you can knock out a WCF-hosting console app in two minutes flat - but is the clunky solution. You of course have to run the host application as a particular Windows user. Perhaps not ideal?
Hosting under a Windows service is the middle ground. It gives you that always-available functionality without having to be logged in as a specific user, but doesn't offer the configurability and scalability of the IIS solution. It takes a bit more effort than belting out a quick console app, but not much.
The server that the windows service will reside on will have the .NET Framework. INSTALLUTIL is located in the Microsoft.NET\Framework(version number) folder in the Windows directory.
For example, C:\Windows\Microsoft.NET\Framework\v2.0.50727.
No need to write a console app to host your service now (unless you want to).
You can also host your WCF service under IIS, check this out: MSDN - How to: Host a WCF Service in IIS. It really is just a five minute job :)

How can I use net.tcp without IIS?

I have a web site and build a wcf service in it. I can run the code by calling it from a test page in the web site. The web site is ran by the vs2010 development server.
I do have IIS 7 but never use it.
Now I want to use the NetTcpBinding instead of BasicHttpBinding, everyone says it should be enabled in IIS, but how can this be done without using IIS and keeping everything in 1 project?
Thanks for any help
edit: A Windows service would be a solution, but that would mean adding a project to the solution, I really want to keep everything in 1 website, took me quite some time to get the service in the website in the first place.
This is about my own test version of the website, the production server is out of my reach. The service must be expanded by other developers later on it's bad if they have to run IIS just to test the service.
One way is to host the WCF service in a Windows Service - see How to: Host WCF in a Windows Service Using TCP for sample code.
Are you talking about how to develop without using IIS7 or how to put the service into a production environment without IIS7?
If it's the latter, then Stuart's answer is correct, but otherwise I would suggest that you start to develop using the web server that you will eventually be hosting the web site/service on.
Hosting in IIS7 has several advantages over hosting in a Windows Service such as fault tolerance and process isolation already built in.
Thanks for the replies guys, it looks like I have 3 options:
1. Host the service in a seperate project.
2. Host the website in IIS.
3. Use HTTPS, also secure.
PS: My development environment is very different from production :(
In development I have unit testing and in production there are old ASP pages, that I can't even acces, but sometimes must refer to...

Hosting requirement: What does WCF need to work?

I plan to start developing with WCF this weekend. Before i get too far along, I'd like to know what I need from my web host? What does our server need to run to enable WCF? Is it standard ASP.NET 3.5 SP1 stuff? Does the host need to do anything to our IIS configuration?
I'm currently hosting our ASP.NET apps, company website, etc. with a third party hosting service. Due to our size, cost, etc. we are using a shared hosting plan and have somewhat limited access to chanign IIS. I'm hoping we don't have any problems that would limit our ability to use WCF.
If you want to host your WCF service in IIS, you need IIS6 (Win Server 2003) or preferably IIS7 (Win Server 2008), the .NET 3.0 (or preferably: .NET 3.5 SP1) framework, and the ability to create virtual directories in IIS (so yes, you need at least some degree of IIS configurability).
That's it! :-)
Marc
You have several options:
You can host in IIS6+ using ASP.NET: simplest, offers integration with ASP.NET runtime (can be disabled to reduce overhead if not needed, imposes requirements on endpoint URLs, restricted to HTTP[S] as transport, all the benefits of IIS worker process management
You can host in IIS7+ using Windows Activation Services (WAS): more advanced, complete control over endpoint URL, can use any transport (TCPIP, HTTP[S], MSMQ, NamedPipes), all the benefits of IIS worker process management
You can host in a custom Windows Service: all the power of WAS except worker process management and you must write your own windows service and you have
For more information, check out this section of the MSDN documentation.

wcf pollingduplex connection limit in silverlight 3.0

I have build a silverlight application for message service. my problem is silverlight application disconnect after 10 connection. But i want it unlimited or thousands. I have spent a lot of time on this problem. some point about my application as:
I have build 3 prject like silverlight project, web project, wcf service project.
Im using PollingDuplexHttpBinding in wcf.that configure with we.bconfig.
In silverlight project i have add service refrence and create service object with pollingduplex binding.
I have configure web.config of wcf service project like :
I have test this project on iis6 server 2003 server but problem same.
please help me to sole this problem.
Thanks
The problem is the number of concurrent threads IIS can run (sounds like you have it configured to run 10 at the moment). You can increase that number through IIS configuration...but performance is going to suffer.
The problem is that Duplex Services hosted in IIS never release their threads...so every user connected to the service sucks up another IIS worker thread. Duplex performance has been discussed elsewhere, but the common tone is this:
IIS can not host scalable Duplex Services.
My suggestion would be to find another way to host those services (WCF outside IIS, Custom Web Server, etc.).
Good luck.
I noticed that my PollingDuplex-software had limit of 10 clients when using one Internet Explorer. The limitation was still there with Windows 2008 Server R2 machine and Web.config having many settings:
for binding: binding name="pollingDu​plexBinding" maxConnections=​"100"
for serviceBehaviors behaviour: serviceThrottli​ng maxConcurrentCa​lls="1000" maxConcurrentIn​stances="1000" maxConcurrentSe​ssions="1000"
and for pollingDuplex maxPendingSessi​ons="2147483647​" maxPendingMessa​gesPerSession="​2147483647"
But then when I tried with different clients:
6 clients on IE on server
6 clients on IE on a different client machine
4 clients on FireFox on this client machine
And it worked. So, there is some kind of limit with same client connections.

Unregistered SecurityContextSecurityToken on WCF

Does anyone recognise this error?
The SecurityContextSecurityToken with context-id=urn:uuid:xxx (key generation-id=) is not registered
It has suddenly appeared in the service trace log of my WCF service.
We had a Windows service successfully transmitting data into the WCF service for a day until it broke. The error manifests when the Windows service tries to connect to the WCF service.
It's highly unlikely that the environments changed. The two services exist on separate machines (an application server and a web server). Both are Windows Server 2003 SP1 machines, and the web server is running IIS 6.
Unfortunately, we have scarce access to the servers to help us debug, so any guesses on what might be wrong would be highly appreciated.
Indi
We had this problem with Web Service Extension 3.0, which was used before WCF. I have not experianced this with WCF, but I think that it is worth checking.
The scenario works like this:
The service starts and the user that is the identity of the service gets logged on.
When the service makes a call it is done in the security context of this user
After a while the logon token becomes so old (a day?) that the service will no longer accept it.
The easy way to test this is to restart the windows service.