简体   繁体   中英

Windows Azure Visual Studio Solution

My application contains 25 C# projects, these projects are divided into 5 solutions.

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.

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.
  • 5 Windows Services.
  • 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. External to the deployment, your hosted service listeners (web, wcf, etc.) are accessed by IP+Port; you cannot access a specific instance unless you also enable 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.

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

Still you can divide your projects into several solution and you have to create that much cloud project and hosted service on azure platform

You can do both.

You can keep your 5 separate solutions as they are. Then, create a new solution that contains all 25 projects.

Which solution you choose to contain your Cloud (ccproj) project(s) will depend on how you want to distribute your application.

Each CCPROJ corresponds to 1 hosted service. 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. 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.

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.

For the Class Libraries, you do not have to convert anything.

Now for the Cloud project(s). 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. 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 .

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.

UPDATE with regards to question update:

So, the Web Application is clear - it goes to one Web Role. Now for the Windows Services. 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)?
  2. Does any of your Windows Services require independent scale?

If the answer for any of the questions is "yes", then put this Windows Service in a single Worker Role. Put all the Windows Services that the answer for both questions is "no" in a single Worker Role. 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. 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. 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. If you have two Hosted Services (Cloud Projects), you will have two solutions.

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM