How best to decouple WebRole start-up resources and EntryPoint from the Web Project
-
2012年3月13日 10:00
Hi,
WebRoles do not require a RoleEntryPoint, but since we currently combine a webrole and workerrole in the same role we need to have RoleEntryPoint.Run implemented in our web role.
We added a RoleEntryPoint class to the Web project, and implemented Run. It works just fine.
However this approach couples the fact the we implement the two roles in one into the Web Project. The web project knows nothing about azure or roles otherwise and we would like to clean the web project, leaving it without any reference or dependency on azure.
We have created a separate 'Azure' only assembly which contains the RoleEntryPoint code, as well as some other Content resources required for startup (as we also have a StartUp task executing).
We have created the NetFxEntryPoint configuration entry and specified the 'Azure' only as the assembly containing the EntryPoint.
My 2 questions are:
1. How do I associate the 'Azure' only with the role, so that its content files and output binaries are deployed with the role? Obviously this can be done by referencing the assembly from the web project, but this would again cause the web project to depend on azure.
2. Is there a better/easier/cleaner way to do what we need?
10x
Dani
すべての返信
-
2012年3月14日 6:37
Hi, Check this link http://www.wadewegner.com/2009/11/how-to-leverage-the-roleentrypoint-in-an-azure-web-role/. MyWebWorkerRole class is WebRole.- 回答としてマーク Arwind - MSFTModerator 2012年3月21日 10:40
-
2012年3月14日 8:41
Ideally you would not be building a cloud solution to be able to be run as a non-cloud solution ... so it's quite possible there might be no clean way to handle this.
If you find a good solution to this, please share it with us. I'm interested in how you would solve it.
Be nice to nerds ... Chances are you'll end up working for one!

