Windows 服务到 Azure?
我用 C# 编写了一个 Windows 服务,它在数据库上执行大量后台管理任务。现在我的客户想要将整个 shebang 迁移到 Azure。我对 Azure 几乎一无所知,而且我的客户说无法在 Azure 上运行 Windows 服务。我在 google 上搜索了这个主题,并得出了一些非常具体的案例研究,说明某人将 Windows 服务迁移到 Azure 的做法,假设对 Azure 的工作原理有相当高的了解,但没有关于 Windows 是否适用的一般性文章服务可以在 Azure 下运行,或者如何调整它们。
我真的很想看到第一个问题的明确答案和解释(你可以在 Azure 下运行 Windows 服务吗?),如果答案是否定的,我很想找到一个分步指南来转换Windows 服务与 Azure 兼容。
谢谢!
I've written a Windows Service in C# that does a whole bunch of background admin tasks on the database. Now my customer wants to migrate the whole shebang to Azure. I know next to nothing about Azure, and my customer says you can't run a Windows Service on Azure. I've googled for this topic and come out with a few very specific case studies of what somebody did to move their Windows Service to Azure, assuming a fairly high level of understanding of how Azure works, but no general articles about whether or not Windows Services can run under Azure, or what to do to adapt them.
I would really like to see a clear answer and explanation to the first question (can you run a Windows Service under Azure?), and if the answer is no, I'd love to find a step-by-step guide for converting a Windows Service to something Azure-compatible.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
是的,您可以这样做 - 有关简单的演练,请参阅 http://blogs.msdn.com/b/mwasham/archive/2011/03/30/migration-a-windows-service-to-windows-azure.aspx
包含相关信息的其他链接:
Yes you can do that - for a simple walkthrough see http://blogs.msdn.com/b/mwasham/archive/2011/03/30/migrating-a-windows-service-to-windows-azure.aspx
Other links with relevant information:
您可以运行任何您想要的内容,包括 Windows 服务。
我认为您会更高兴转换为 WorkerRole 应该非常简单。
You can run whatever you want, including a Windows Service.
I think you'd be happier converting to a WorkerRole, though, which should be very straightforward.
对于较小的作业,您可以使用 Azure 的 WebJob 工具,该工具在 Web 应用程序中运行(如果您对前端站点管理的相同数据执行后台任务,则非常有用)。
这里有一个很好的细分:
https://azure.microsoft.com /en-us/documentation/articles/web-sites-create-web-jobs/
WebJobs 很容易运行,但不具备辅助角色的功能。请参阅以下内容进行比较:
辅助角色与 Web 作业
For smaller jobs, you can use Azure's WebJob facility, which runs within a web app (useful if you're doing background tasks on the same data that a front-end site is managing).
There's a nice breakdown here:
https://azure.microsoft.com/en-us/documentation/articles/web-sites-create-web-jobs/
WebJobs are pretty easy to get running, but don't have the power of Worker Roles. See the following for a comparison:
Worker Role vs Web Job
是的,没问题,这是另一个很好且易于遵循的示例 Azure 云服务入门。它(还)清楚地展示了如何实现 WorkerRole。您可以使用 WebRole 来管理您的服务。
Yes, no problem, here is another nice and easy to follow example Get Started with Azure Cloud Services. It (also) clearly shows how to implement the WorkerRole. You can use the WebRole to manage your service.
以下是在运行 Windows Server 2012 R2 的 VM 的 Windows Azure 上安装 Windows 服务的步骤:
将存储映射为 VM 中的新驱动器:< /p>
net use z: \mystorage.file.core.windows.net\endoint /u:myusernameverylongkeythatendswith==
存储密钥可以在您的 Azure 管理控制台中找到 ->存储->管理访问密钥
用户名和密码应该是您用于创建 VM 的用户名和密码。
享受!
PS:我使用 NSSM 来简化服务部署。
Here are the steps to install a windows service on Windows Azure running VM with Windows Server 2012 R2:
map your storage as a new drive in your VM:
net use z: \mystorage.file.core.windows.net\endoint /u:myusername verylongkeythatendswith==
Storage key can be found in your Azure Management Console -> Storages -> Manage Access Keys
Username and password should be the ones you used to create the VM.
Enjoy!
PS : I used NSSM to simplify the service deployment.
我会为此使用网络作业,它的调度功能和简单的部署/配置使这成为一项微不足道的任务。压缩 .exe 并上传,然后设置时间表就大功告成了。
I would use web jobs for this, it's scheduling functionality and easy deployment/config makes this a trivial task. Zip up your .exe and upload it, then set a schedule and you're done.
是的,你可以,在网站中有一个任务 Web 作业,你可以创建批处理、wsh、powershell(需要 azure power shell)或使用 Web 作业 API、rest API,另一方面,我们有 azure 自动化,但类似使用工作流程
Yes u can , in the website there are a task web jobs y can create a batch, wsh, powershell(need the azure power shell) or using the web jobs API, rest API, on the other hand we have azure automation is similar but use work flow