0
votes

I've created a Windows Azure project in Visual Studio 2012 that contains both a web role (an MVC 4 project) and a worker role. I've also created a cloud service and a web site in the Windows Azure management portal. When I deploy the project it deploys both to the cloud service and creates an instance for both the web and worker roles.

I was wondering if it were possible that when I select to deploy the project that it deploys the web role to the website and the worker role to the cloud service?

Any advice would be greatly appreciated. Thank you

1

1 Answers

2
votes

In order to accomplish what you're trying to do, first you would need to remove the WebRole project from your Cloud Services Project. To do that, click on cloud service project, then expand Roles node and remove the WebRole project from there. Now when you deploy this cloud project, only worker role will get deployed. Since the web role is now no longer a part of your cloud services project, you will have to deploy it separately. In order to do that, you just right click on the web project and then publish that project.

Another thing you would need to keep in mind is that your web role is now a standard web application thus it won't be able to read from service configuration file or do any thing (like diagnostcs etc.) which you would normally do when a web role is part of a cloud service. All settings in your service configuration file should go under appSettings section in web.config file.