You will need a Windows Azure Account, if you don’t have one you can take advantage of the 1 month free trial.
It is 1 month or US$200.00 credit, when your credit gets to zero the account will be closed or when you reach the month, whatever comes first. Previously the trial period was 3 months, it has changed, they say is for good. By the way when the trial ends you can’t use the same Windows live account again to set another one.
Create a Windows Azure account. You’ll need:
- a valid Microsoft Account, previously known as Windows Live ID (like one from Hotmail)
- a cell phone to receive a SMS message sent from Microsoft to validate the account creation.
- a credit card (like Visa, MasterCard, etc.) you won’t be charged because the account is a special zero dollars account.
By the way Microsoft will contact you by phone number, now you know.
Provision a web site and a database in Azure.
Log in Windows Azure Portal, click on +New, Compute, Web Site, Create with Database.
A dialog will open called “Create Web Site”, create a URL, this is the one you will use to access the application from your device (PC, Tablet, etc.) Example:
Pick a region close to where you are. In DATABASE select “Create a new SQL database”. In CONNECTION STRING NAME you can put a different name to the connection string. Next.
Now we specify database settings, put a name to the database, select New SQL Database Server, create a LOGIN NAME and a PASSWORD (twice as usual), you can select a REGION here too. Don’t check “Configure advanced database settings”. Click Finish (the check mark).
That concludes the Azure web site and database creation. Use the ALL ITEMS to see both services running.
Open the firewall on your database to let LightSwitch publish to the database remotely. Select your database and click MANAGE at the bottom, Azure will ask you if you want to enable management of the database from you current IP, select YES.
Publishing the LightSwitch Application.
Now in Visual Studio or LightSwitch IDE, first change the Project settings from DEBUG to RELEASE. If you are planning in using the authentication mechanism then activate Forms Authentication.
In Solution Explorer right click and select “Publish…”, the Publish Wizard will guide you:
- Select “Complete application”, next.
- Select “Windows Azure”, next
Visual Studio will ask for the Windows Azure SDK for .NET (VS 2012)
- Click “Sign in to download credentials”, this will open a web browser and take you to your Windows Azure account there you need to download a settings file with the file extension “.publishsettings”. Use this file with the import button in the Publish Wizard. Once imported these settings are saved and encrypted in your profile so you can delete the settings file if you want. Next.
- Select “Web Site”, next.
- Choose which website you want to publish to. Select the one you just created, next.
- If you activated Forms Authentication then you need to provide the Admin’s credentials. Choose “Yes, create an Application Administrator” and fill the user name, full name, password and confirm password. You will need this credential when testing the application.
- Click the tab “HTTPS” choose “No, HTTPS is not required”. Next.
- Database Connections, next.
- Review the information and click Publish.
- When successfully finished you can access your application both the rich desktop client and the HTML client via a web browser:
For Desktop client: yourwebsite.azurewebsites.net/Client
For HTML client: yourwebsite.azurewebsites.net/HTMLClient
Extracted from: LightSwitch HTML Client Tutorial – Contoso Moving