Hosting console application on Azure or Amazon, is it possible?

∥☆過路亽.° 提交于 2019-12-05 18:05:22

问题


I would like to know if it's possible to write a console application to port on Windows Azure.

The console application wouldn't have an interface, it would just do its work without informing what it's doing to the user. In this case it would be a socket application.

I don't want it to be a website. It wouldn't be of any addition to the project.

EDIT: Thank you all for replying to me so fast. Now I have an answer to what I've been looking for. Now my qustion is: what would it be called in Amazon? It's worker role on Azure ... now I know that thanks to all of you


回答1:


You cannot directly host a console app in Azure or any other cloud. As Ghyath said you will have to use worker role in case of Azure.

Take a look at this sample which demonstrates how you can convert a Console App in to a worker role in windows azure. See Task1.




回答2:


You can absolutely run a console application in Windows Azure, in either a Web or Worker Role (which are both Windows Server 2012 or 2008 R2/SP2), and you can typically run them unmodified. You'll need to:

  • Provide the binaries or installer for your console app, along with any additional support DLLs. You can make these a part of your deployment or store them in Blob Storage and copy them locally upon VM bootup.
  • Configure Input Endpoints for tcp/http/https ports your console app is listening on
  • Handle stdout/stderr output
  • Configure local storage for temporary files / cache / etc. that the console app needs
  • Launch your console app in either OnStart() (the preferred place, which is called prior to your VM instance being placed in the load balancer) or Run().

You need to think about how the console app runs when there are multiple VM instances. Can two instances of your console app run at the same time? If not, you'll need to set up a mutex check prior to launching your console app executable.

Steve Marx recently blogged about running the Mongoose Web Server in Windows Azure (Mongoose being a C++-based console application). All code is in the PackAndDeploy project on github, so you can take a look at how he set things up.

EDIT 7/27/2013 This answer is a bit dated. You can also run console apps in Windows or Linux Virtual Machines. And you now have Windows Server 2012 as an OS choice for web/worker role instances.




回答3:


On Amazon there isn't a "worker role" and related super easy deployment. You can simply deploy your console application and start it on your EC2 instance manually or through a scheduled task. If your app must run unattended and without a logged on user then you have to rely on a Windows Service deployed on AWS EC2.




回答4:


You can use a Worker Role in Windows Azure. Output can be written to certain monitors.




回答5:


You cannot host a console application, there is something called Worker Role that you can use it.



来源:https://stackoverflow.com/questions/8711809/hosting-console-application-on-azure-or-amazon-is-it-possible

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!