有没有一种简单的方法可以在不重新发布服务的情况下替换 Azure 云服务引用 dll?

Is there an easy way to replace Azure Cloud Service reference dll without re-publishing the service?

我在云服务中有一个 Azure 辅助角色 运行。工作人员是我运行代码的自定义库的包装器。当我更改我的库时 我想用新的 简单地替换旧的。目前我必须重新发布整个 Cloud Service 项目,这需要时间并且似乎是在浪费精力。我知道当我有多个实例或其他问题时可能有必要,但现在我只想将我的新 dll 复制到服务而不是发布整个项目。

这可能吗?

在开发和测试 Azure 应用程序时,您可以使用 Web 部署为您的 Web 角色增量发布更改。

更多信息: https://msdn.microsoft.com/en-us/library/azure/ff683672.aspx

对于 webrole Web 部署可以增量添加新文件。如果您不想启用 Web 部署,则需要为该角色启用远程访问,然后您可以连接到实例并替换 .dll 文件。

根据角色,您需要找到 IIS 文件夹(如果是 Webrole)或访问 "%ROLEROOT%\AppRoot"(如果是辅助角色)。

您可能需要在 Web 角色场景中重新启动 IIS 实例。对于工作者角色,您需要杀死 WaWorkerHost,它会自动重启

在阅读了 Ralf 链接的文档后,我发现了这个:

If your app’s backend infrastructure is stable, but the web roles need more frequent updating, you can use Web Deploy to update only a web role in your project. This is handy when you don’t want to rebuild and redeploy the backend worker roles, or if you have multiple web roles and you want to update only one of the web roles.

稍后重申:

Only web roles can be updated: Worker roles can’t be updated. In addition, you can’t update the RoleEntryPoint in web role.cs.

对于任何想要更新网络角色的人来说,记住这个要点非常重要:

The changes are made directly to the virtual machine where the web role is running. If this virtual machine has to be recycled, the changes are lost because the original package that you published is used to recreate the virtual machine for the role. You must republish your application to get the latest changes for the web role.