Exporting data into Excel is a common task for almost every application. Having Windows Azure as an environment for creating highly scalable & available robust applications, there is very big chance that an Azure based application will need to export data into Microsoft Excel format. This will be a short post, a continuation to the WebExcelExporter / NetAdvantage for ASP.NET 10.2 SR, which will move the existing application to Windows Azure platform. You can also refer to this post as a startup point for migrating existing Web Application to Windows Azure. Take the attached sample web application from previous post and unzip in a folder of your choice. You will need it later.
To begin, open a Visual Studio 2010 instance and select “File” –> “New” –> “Project” –> “Cloud”. Give your project a name, and just hit “OK” on the “New Cloud Service Project” wizard, which opens. Do not add any roles! This will create a new Solution for you with only one CloudService project. Now right click on your Solution in Solution Explorer and select “Add” –> “Existing Prject”:
Locate the previously saved and unzipped “WebExcelExporter” project and select the WebExcelExporterDemo.csproj file. Now your solution will have the Cloud Service project and the Web Application project:
Let’s link the two! Right click on “Roles” folder in the Cloud Service project, select “Add”, and then choose “WebRole project in solution …”:
This will open a new window that will enlist all Web Application projects in current solution. In our case we have to choose the only one listed (WebExcelExporterDemo):
That’s it! Now you have a Cloud Service application with one Web Role, which has WebExcelExporter in it! To publish in Windows Azure environment you do not have to forget the Windows Azure Web Role deployment Checklist and mark Infragistics Assemblies with Copy Local attribute equal to true:
With that set, your application is ready for Azure!
Well, there is a catch!
WebExcelExporter does not work in Windows Azure Development Fabric! It will cause Out Of Memory Exception. However it works perfectly when deployed on real Windows Azure platform. So be aware of that, and do not afraid to publish your application to the Windows Azure platform. It will run just fine there! We are working on identifying the issue with Development Fabric.