简体   繁体   English

Windows Azure Visual Studio解决方案

[英]Windows Azure Visual Studio Solution

My application contains 25 C# projects, these projects are divided into 5 solutions. 我的应用程序包含25个C#项目,这些项目分为5个解决方案。

Now I want to migrate these projects to run under Windows Azure, I realized that I should create one solution that contains all my web roles and worker roles. 现在,我想将这些项目迁移到Windows Azure下运行,我意识到我应该创建一个包含所有Web角色和辅助角色的解决方案。

Is this the correct way to do so, or still I can divide my projects into several solution. 这是这样做的正确方法,还是我仍可以将项目分为几个解决方案。

The Projects are as shown below: 这些项目如下所示:

  • One Web application. 一个Web应用程序。
  • 5 Windows Services. 5 Windows服务。
  • The others are all class libraries. 其他都是类库。

Great answers by others. 其他人的好答案。 Let me add a bit more about one vs. many hosted services: If the Web and Worker roles need to interact directly (eg via TCP connection from Web role instance to a specific worker role instance), then those roles really should be placed in the same hosted service. 让我再详细介绍一个托管服务和许多托管服务:如果Web角色和Worker角色需要直接交互(例如,通过从Web角色实例到特定Worker角色实例的TCP连接),那么这些角色实际上应该放在相同的托管服务。 External to the deployment, your hosted service listeners (web, wcf, etc.) are accessed by IP+Port; 在部署外部,您的托管服务侦听器(Web,WCF等)可以通过IP + Port访问; you cannot access a specific instance unless you also enable Azure Connect (VPN). 您不能访问特定实例,除非您还启用了Azure Connect(VPN)。

If your Web and Worker roles interact via Azure Queues or Service Bus, then have the option of deploying them to separate hosted services and still have the ability to communicate between them. 如果您的Web角色和Worker角色通过Azure队列或Service Bus进行交互,则可以选择将它们部署到单独的托管服务中,并且仍然可以在它们之间进行通信。

You are correct ! 你是对的 ! and all projects goes to under 1 hosted service if you create only one cloud project for all your webrole and worker role project 如果您为所有webrole和worker角色项目仅创建一个云项目,则所有项目都将归类于1个托管服务

Still you can divide your projects into several solution and you have to create that much cloud project and hosted service on azure platform 仍然可以将项目分为多个解决方案,并且必须在azure平台上创建那么多云项目和托管服务

You can do both. 两者都可以。

You can keep your 5 separate solutions as they are. 您可以按原样保留5个单独的解决方案。 Then, create a new solution that contains all 25 projects. 然后,创建一个包含所有25个项目的新解决方案。

Which solution you choose to contain your Cloud (ccproj) project(s) will depend on how you want to distribute your application. 选择包含云(ccproj)项目的哪种解决方案将取决于您希望如何分发应用程序。

Each CCPROJ corresponds to 1 hosted service. 每个CCPROJ对应1个托管服务。 So you could put all of your webs and workers into a single hosted service. 因此,您可以将所有网站和工作人员置于单个托管服务中。 Or you could have each web role as a different hosted service, and all of your worker roles together on another hosted service. 或者,您可以将每个Web角色作为不同的托管服务,而所有工作角色都一起放在另一个托管服务上。 Or you could do a combination of these. 或者,您可以将这些组合。 A definitive answer would require more information about your application, but in VS, a project can belong to more than 1 solution. 一个明确的答案将需要有关您的应用程序的更多信息,但是在VS中,一个项目可以属于多个解决方案。

The most important question is: How many of these 25 projects are actual WebSites/Web Applications or Windows Services, and how many of them are just Class Libraries. 最重要的问题是:这25个项目中有多少个是实际的WebSite / Web应用程序或Windows服务,而有多少个仅仅是类库。

For the Class Libraries, you do not have to convert anything. 对于类库,您无需转换任何内容。

Now for the Cloud project(s). 现在适用于Cloud项目。 You have to decide how many hosted services you will create. 您必须决定要创建多少个托管服务。 You can read my blog post to get familiar with terms like "Hosted Service", "Role", "Role Instance", if you need to. 如果需要,您可以阅读我的博客文章以熟悉诸如“托管服务”,“角色”,“角色实例”之类的术语。

Once you decided your cloud structure - the number of hosted services and roles per each service, you can create a new solution for each hosted service. 一旦确定了云结构-托管服务的数量以及每个服务的角色,就可以为每个托管服务创建新的解决方案。

You can also decide that you can host multiple web sites into a single WebRole, which is totally supported and possible, since WebRoles run in full IIS environment since SDK 1.3. 您还可以决定将多个网站托管到一个WebRole中,这是完全受支持的,并且是可能的,因为WebRoles自SDK 1.3起就在完整的IIS环境中运行。 You read more about hosting multiple web sites in single web role here and here , and even use the Windows Azure Accelerator for Web Roles . 您可以在此处此处阅读有关在单个Web角色中托管多个网站的更多信息,甚至可以使用Windows Azure Accelerator for Web Roles

If you have multiple windows services, or a background worker processes, you can combine them into a single Worker Role, or define a worker role for each separate worker process should you desire separate elasticity for each process, or your worker require a lot of computing power and memory. 如果您有多个Windows服务或后台工作进程,则可以将它们合并为一个工作角色,或者如果您希望每个进程具有独立的弹性,或者您的工作人员需要大量计算,则可以为每个单独的工作进程定义一个工作角色。电源和内存。

UPDATE with regards to question update: UPDATE至于问题的更新:

So, the Web Application is clear - it goes to one Web Role. 因此,Web应用程序很明确-它属于一个Web角色。 Now for the Windows Services. 现在用于Windows服务。 There are two main considerations that you have to answer in order to find whether to put them into a single or more worker roles: 您必须回答两个主要注意事项,以查找是否将它们置于单个或多个工作人员角色中:

  1. Does any of your Windows Services require excessive resources (ie a lot of computing power, or lot of RAM)? 您的Windows服务是否需要过多的资源(例如,大量的计算能力或大量的RAM)?
  2. Does any of your Windows Services require independent scale? 您的Windows服务是否需要独立扩展?

If the answer for any of the questions is "yes", then put this Windows Service in a single Worker Role. 如果对任何一个问题的回答为“是”,则将此Windows服务置于单个辅助角色中。 Put all the Windows Services that the answer for both questions is "no" in a single Worker Role. 将所有两个问题的答案都为“否”的Windows服务放在一个辅助角色中。 That means that you will scale all of them or none of them (by manipulating the number of instances). 这意味着您将缩放所有它们或不缩放它们(通过操纵实例数)。

As for Cloud Service (or the Hosted Service), it is up to you to decide whether to use a single cloud service to deploy all the roles (Web and Workers) or use one Hosted service to deploy the Web Role and another one to deploy the Worker Roles. 对于云服务(或托管服务),由您决定是使用单个云服务来部署所有角色(Web和Workers)还是使用一个托管服务来部署Web角色,使用另一个服务来部署工人角色。 There is absolutelly no difference from billing prospective. 与预期计费绝对没有区别。 You will still have your Web Role and Worker Role(s), and you will be charged based on instances count and data traffic. 您仍将具有Web角色和辅助角色,并且将根据实例计数和数据流量向您收费。 And you can independently scale any role (change the number of instances for a particular role) regardless of its deployment (within the same hosted service, or another hosted service). 而且,您可以独立地扩展任何角色(更改特定角色的实例数),而无需考虑其部署(在同一托管服务或其他托管服务中)。

At the end I suggest that you have single solution per Hosted Service (Cloud Project). 最后,我建议您对每个托管服务(云项目)有一个解决方案。 So if you decide to have the Web Role and Worker Roles into a single Hosted Service, than you will have a single solution. 因此,如果您决定将Web角色和辅助角色整合到一个托管服务中,那么您将拥有一个解决方案。 If you have two Hosted Services (Cloud Projects), you will have two solutions. 如果您有两个托管服务(云项目),则将有两个解决方案。

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 具有在Azure上托管的两个项目的Visual Studio解决方案 - Visual Studio Solution with Two Projects Hosted on Azure 在Visual Studio 2017中使用Windows Silverlight开发的解决方案? - Solution for developing in Windows Silverlight in Visual Studio 2017? 如何从Visual Studio上传解决方案到vsts / Azure Devops - how to upload a solution to vsts/ azure devops from visual studio 将现有的 Visual Studio 2022 解决方案添加到新的 Azure Git 存储库 - Adding an existing Visual Studio 2022 Solution to a new Azure Git Repository 将 Visual Studio 解决方案连接到不同的 Azure Devops 项目 - Connect Visual Studio solution to different Azure Devops projects Windows 使用 Visual Studio Community 2019 的 Office 解决方案安装程序 - Windows Installer for Office solution by using Visual Studio Community 2019 Visual Studio 2015 RC无法在Windows 10上创建任何解决方案 - Visual Studio 2015 RC fails to create any solution on Windows 10 Visual Studio自动化:枚举解决方案加载时打开的窗口 - Visual studio automation: Enumerate opened windows upon solution loading Visual Studio 中用于在 Windows 文件资源管理器中打开解决方案的快捷方式? - Shortcut in Visual Studio to open solution in Windows file explorer? Visual Studio解决方案参考 - Visual Studio Solution References
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM