0

Hi I am implementing a TCPIP listener in Azure WorkerRole. The WorkerRole listens for incoming TCP data and stores it in Azure Table Storage.

Everything is working fine when i do this in Run() of WorkerRole.

But when implement the same thing in a Run() of WebRole, i get a message "WebIIS has exited" and debug mode exits in dev environment.

Why is this?

Can some one explain where the WebRole difers from WorkerRole? Can we implement a TCPIP listener which continuously listens in a WebRole?

Thanks Anil

Anil Maddala
  • 898
  • 16
  • 34

3 Answers3

0

Just think that WebRole works like a Web Application. by receiving a request then it returns a reponse while Worker Role works like a Windows Service. Although both can hand TPC messages they difers in the way they hand it. Web Role only will be available while process the request. Worker Role will be available constantly. If you want a Web Role to be continuosly listening a TCP channel the most probably is that Worker Role will fit your requierements better.

Regards,

  • This isn't true. A web role has a `RoleEntryPoint` just like a worker role and can run any code at any time (with or without an incoming request). – user94559 May 04 '12 at 15:17
  • Hi Smarx, so based on what your answer in http://stackoverflow.com/a/2610895/94559, WebRole = WorkerRole+IIS. Executing the same code in Run() of webrole is making the webrole unstable, but the same code is working fine in WorkerRoel. What could be the reason and Is there any specific reason you think a worker role is best suited in this case? – Anil Maddala May 04 '12 at 15:56
0

My answer on a similar question: https://stackoverflow.com/a/2610895/94559

In short, web roles are for IIS, and worker roles are for everything else. In this case, I think you want a worker role.

Community
  • 1
  • 1
user94559
  • 59,196
  • 6
  • 103
  • 103
  • Hi Smarx, so based on what your answer in http://stackoverflow.com/a/2610895/94559, WebRole = WorkerRole+IIS. Executing the same code in Run() of webrole is making the webrole unstable, but the same code is working fine in WorkerRoel. What could be the reason and Is there any specific reason you think a worker role is best suited in this case? – Anil Maddala May 04 '12 at 15:57
  • Yes Web role == Worker Role + IIS. It depends what that code is. What's the error you're getting? One thing to watch out for is that in a web role, IIS binds to (I believe) all your input endpoints, so if you're trying to bind to something and getting an error, it might be because IIS has already nabbed the port. – user94559 May 04 '12 at 16:10
  • In the development machine i keep getting the error, WaIISHost.exe: Managed (v4.0.30319)' has exited with code -66053 (0xfffefdfb) – Anil Maddala May 04 '12 at 18:05
  • There’s a similar thread on http://social.msdn.microsoft.com/Forums/en-ZA/windowsazuredevelopment/thread/cae78b8b-aab7-4e42-b2da-73ae5c36ddbb which may help. It uses a worker role, though. – Ming Xu - MSFT May 07 '12 at 09:34
0

What is an Azure Cloud Service Role?

In Azure, a Cloud Service Role is a collection of managed, load-balanced, Platform-as-a-Service virtual machines that work together to perform common tasks. Cloud Service Roles are managed by Azure fabric controller and provide the ultimate combination of scalability, control, and customization

What is a Web Role?

Web Role is a Cloud Service role in Azure that is configured and customized to run web applications developed on programming languages / technologies that are supported by Internet Information Services (IIS), such as ASP.NET, PHP, Windows Communication Foundation and Fast CGI.

What is a Worker Role?

Worker Role is any role in Azure that runs applications and services level tasks, which generally do not require IIS. In Worker Roles, IIS is not installed by default. They are mainly used to perform supporting background processes along with Web Roles and do tasks such as automatically compressing uploaded images, run scripts when something changes in database, get new messages from queue and process and more.

Pankaj Rawat
  • 4,037
  • 6
  • 41
  • 73