IIS Hosted WCF Service with TCP endpoint stops after Application Pool Recycle - wcf

I have an IIS application which hosts a TCP WCF service in Global.asax. I use that service to make interrole communications between my roles in Windows Azure. The problem is WCF services stops working after application pool recycles(29 Hours). After that, my interrole requests starts to fail.
How can I control recycle event to keep my webroles alive. What is the best solution to do it?
I tried auto-start feature but it didn't work.

You should install and use Appfabric with iis7.0 It has an auto start feature that is configurable
http://msdn.microsoft.com/en-us/library/ee677312(v=azure.10).aspx

Related

Host WCF service with net.tcp binding through IIS Manager 7.5

I am fairly new to hosting web applications and web services. Though I was successful in hosting a web application, I am running into road block after road block when trying to host a WCF service with net.tcp binding.
My scenario is as follows, I have a hosted web application that needs to communicate with a hosted WCF service with net.tcp binding through IIS 7.5. As stated the web application is hosted fine and I can browse the web site. However, the web application makes services calls to the WCF service and I am getting the 'TCP error code 10061' message which I believe is due to my hosted WCF service not running. I think this is not running because I attempt to 'telnet localhost 808' to see if the WCF service is running and it is not. I've run through numerous online guides and I still have had no luck. I believe I may be doing something fundamentally wrong with me being a noob and all. I am able to host the service through VS2010 and run the web application and it works fine so I believe my bindings are correct. I've also enabled tcp protocols on both websites in IIS Manager.
So I guess my real question is what are the IIS Manager steps needed to host a WCF service with net.tcp binding? It appears to me that it is not possible to host a net.tcp service through IIS Manager by simply creating a website because IIS Manager wants to bind to an http port.
Here are some things to check:
Ensure the Net.Tcp Listener Adapter windows service is running
Ensure netTcp is listed as an enabled protocol for your website (In IIS Manager, go to Advanced settings for your site)
Ensure netTcp is listed as an enabled protocol for application (directory) that is hosting your services (In IIS Manager, go to the directory hosting your services and select Advanced Settings)
Ensure your IIS site has a binding for net.tcp, with the correct port number listed.
EDIT:
See the following MSDN page for enabling/using non-HTTP bindings in .Net 4 + IIS 7/7.5:
Configuring the Windows Process Activation Service for Use with Windows Communication Foundation
And I discovered that for me it didn't work to use localhost... You should use 127.0.0.1 or the name of your computer.

Can windows managed service be a wcf client?

On 1st server, there is wcf service hosted in windows managed service. On the 2nd server, there is another wcf service, hosted in their own windows managed service. I try to connect to 1st service from the inside of the 2nd service, but I become a exception "The socket connection was aborted". With same configuration and same code I successfully connect from console application and winform application, but not from this windows managed service.
Configure your WCF services on both servers to perform diagnostic logging. Follow the instructions in http://msdn.microsoft.com/en-us/library/ms730064.aspx to achieve that.
Make sure the account your service on server 2 is running under is capable of connecting to server 1. This is a typical difference between the client test you did (and worked) and a service running on that system. For a test, make the service on server 2 run under your personal login credentials.

Unable to host a Service Bus WCF Host in IIS on Azure

I have worker roles that send out multicast messages using the azure service bus. Two of the consumers of these messages are websites hosted on Azure. I know that there are issues hosting service bus WCF endpoints in IIS even when running on premise. I've followed the Microsoft's advice and configured a service host programmatically.
One of the websites has been using this technique successfully for quite a while. It uses the hosted web core (it was developed before full IIS was an option on Azure) and it initialises the service host as part of the RoleEntryPoint.OnRun(). I'm trying to move this site to using full IIS. Because in full IIS the RoleEntryPoint runs in a different process to the site itself and the service host needs access to some static variables in the site I've moved the initialisation of the service host to the Global.asax Application_OnStart. This code works fine when running as a website under IIS locally and it runs fine when running in the compute emulator, but once I deploy it to the cloud my WCF host never seems to receive any messages. I haven't been able to catch any errors that are occurring.
Has anyone else out there successfully deployed something like this?

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.

Can I host a WCF service with NetMsmqBinding in root "/" application of an IIS7 site?

I have created a WCF service with NetMsmqBinding, and hosted it in IIS7 using Windows Activation Service (WAS).
Current (works perfectly):
Hosted in IIS at: http://localhost/MyService/MyService.svc
With the service endpoint address: http://localhost/private/MyService/MyService.svc
And the corresponding queue: .\private$\MyService/MyService.svc
Desired (does nothing, not even an error message):
Hosted in IIS at: http://localhost/MyService.svc
With the service endpoint address: http://localhost/private/MyService.svc
And the corresponding queue: .\private$\MyService.svc
Everything works perfectly when I use the MyService IIS application. But the same setup (code, IIS security, queue security, etc.) does nothing when I try to use the root "/" app instead of the "MyService" app to host the service. I don't get any errors in the Event Log. The incoming messages just sit in the queue.
Is hosting a WAS-activated service supported in in the root application of an IIS7 site?
I found a bug whereby hosting WCF services in the root (spent a lot of time on the phone with MSFT Support), thus host them in an application.
For example, I have a netMsmqBinding service hosted in IIS7, it is configured for WAS and it is hosted in the default site as:
http://mymachine/msmqtest/service.svc
The queue name for MSMQ needs to be called:
"msmqtest/service.svc"
And the endpoint in the config needs to be:
net.msmq://mymachine/private/msmqtest/service.svc
Also, make sure you are using the machine name in the config, NOT a host header name or something. MSMQ works from computer to computer, very important.
Hosting of WAS Activated Services do work rooted. I'm not 100% sure about the netMsmqBinding. the end point would need to be http://localhost/service.svc not /private though.