In a previous post I created a LightSwitch application that consumes an OData service that provides vehicle registration information. Users can enter a license plate and technical information is returned. Creating this application was relatively easy and I only had to write exactly one line of code. But running this application just on my own laptop is not very 2.0. In this post I create a Windows Azure Web Site (WAWS) that hosts this LightSwitch application.
Creating the Windows Azure Web Site
First step is to create a Windows Azure Web Site where the LightSwitch application can be hosted. To do this you need a Windows Azure subscription and request the WAWS preview. After logging into the Azure Portal I create a new WAWS. I specify a URL, a location and a subscription. WAWS are only available in the US during preview.
Settings are confirmed at the bottom right corner. The dialog closes and a new entry is added to the table of web sites. It takes less than a minute to create the web site. When ready, the web site can be visited and displays the default content of a WAWS.
Deploying the LightSwitch application
To publish the LightSwitch application, click the project in the Solution Explorer in VS2012 and select “Publish…”. The Publish Wizard starts and I choose the Web application type. Next I choose my web application to be hosted in Windows Azure instead of the local IIS. The third action in the wizard is to select the subscription to be used. Subscriptions must be added before they can be selected in the Wizard. To add a subscription download the publish settings from the Windows Azure Portal. To do so, select the WAWS and click the “Download publish profile” hyperlink.
The downloaded XML file containing various settings including subscription details and can be imported into the LightSwitch Publish Wizard.
In the next step I select Web Site because I want a WAWS and not an Azure Cloud Service (web role). In the next step, Service Configuration, I select the web site I created earlier. Since the LightSwitch application only shows publically available data and no privacy related information an HTTP connection is all I need.
The last step is to provide the OData connection details.
These details can be found in the Windows Azure Marketplace. The Service URL can be found at the data provider. User Name is the customer-id of the Windows Azure Marketplace subscription and Password is the service specific account key that is provided to you when purchasing an Windows Azure Marketplace data set. Finally, press the Publish button to start publishing the LightSwitch application to a Windows Azure Web Site. Publishing takes about 1 minute.
Up and running
When the publish has completed the web site is up and running. And it’s not running on localhost anymore…
In the third post in this series I will deploy the LightSwitch application into a Cloud Service. Cloud Services offer additional features and better scalability.