How best to decouple WebRole start-up resources and EntryPoint from the Web Project

回答済み 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


すべての返信