Azure Web 角色如何在没有入口点的情况下运行?
出于好奇,我打开了 Azure Web 角色项目,导航到包含 RoleEntryPoint
后代类的文件,并完全删除了该类定义。然后我打包了该角色并将其部署在 Azure 中 - 该角色启动时没有任何错误指示。
这怎么可能行得通?
Out of curiosity I opened my Azure web role project, navigated to the file that contained the RoleEntryPoint
descendant class and completely removed that class definition. Then I packaged the role and deployed it in Azure - the role started without any error indication.
How could that possibly work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
除了 DarwkwingDuck 所说的之外,我只想提到 RoleEntryPoint 提供了在角色实例初始化、运行和停止时运行代码的方法。
如果我们继续阅读 MSDN 上的 RoleEntryPoint 类文档< /a> 我们还将看到以下内容:
因此,Web 角色可以选择扩展 RoleEntryPoint 类。
In addition to what DarwkwingDuck said, I will just mention that RoleEntryPoint Provides methods to run code when a role instance is initialized, run, and stopped.
If we continue to read through the RoleEntryPoint class documentation on MSDN we will also see the following:
So, Web roles can optionally extend the RoleEntryPoint class.
无论您是否从它继承,RoleEntryPoint 都存在于您的部署中。请注意,该类中的所有方法都会重写基类实现。如果您不继承 RoleEntryPoint,则将执行这些基类实现。
这也使得将遗留应用程序引入 Azure 变得更加容易 - 只需将现有的 Web 应用程序作为角色添加到云项目中即可。
The RoleEntryPoint exists in your deployment regardless of whether or not you inherit from it. Notice that all the methods you have in that class override the base class implementations. Those base class implementations will execute instead if you don't inherit RoleEntryPoint.
This also makes it easier to bring legacy apps into Azure - just add an existing web app to a cloud project as a role and away you go.