Quick Inquiry

Porting ASP.NET applications to Windows Azure

Porting your app to Windows Azure, for newbies is a challenging task. However, with little patience and meeting pre requisites, you can easily replenish this otherwise highly challenging task. Before you start, make sure you have an active Azure account and a working SQL Azure Database. In case you don’t, set up your new account at Azure store and create a temporary database ‘database_alfa’ in SQL Server Management Studio. Also make sure that your firewall settings do not stop your application from running.

ASP.NET applications


The step involves in migrating database are:

1. Migrate the alfa.MDF (application)
2. Migrate ASP.NET web application development service providers
3. Change the connection strings

1. Migrating Alfa.MDF:

• Open SQL Server Management and connect using .SQLExpress
• Select ‘Attach’ under Database.
• Select ‘Add’ and locate ‘alfa.MDF’ from your directory, upload it.
• Select alfa database (that you just added), Select Tasks-> Generate Scripts.
• Click Next twice and select ‘Advanced’ under Set Scripting Options
• Scroll to ‘Script for database engine type’ and opt ‘SQL Azure Database’
• Based on your type of data, select related script option from schema only, the schema and data or data only.
• Save the script file and open it in SSMS.
• Our next task here is to connect to SQL Azure. Right Click Connect button from Object Explorer and choose ‘Database Engine’
• When asked server name, write your SQL Azure portal name with your domain name. i.e. zkymadd998.database.windows.net. Also enter the same Server name in Connect to Server dialog for SSMS.
• Login to your SQL Azure portal.
• Select ‘Options->Connection Properties’ and enter alfa.db against ‘Connect to database’, this shall place the SQL Azure database in SSMS object explorer.
• Open a new SQL Query window from ‘New Query’ option under SQL Azure Database.
• Execute the query window after copy, pasting the database script. Successful query execution would appear after running your query against the alfa.db.

ASP.NET developers


2. Migrate ASP.NET providers:

• Import your scripts and extract them from existing data source.
• Open InstallCommonSQL script from SSMS and select ‘Connection | Disconnect’ from query window in order to connect to ‘beta.db’.
• Right Click SQL Query window, and enter beta.db as the connect to database.
• Run script; open InstallMembership.SQL and installprofile.SQL, and run them against beta.db.

ASP.NET web applications


3. Changing Connection String:

• Finally we need to change our connection strings in connectionstrings.config file in our project.
• Change the user ID and Password, also change database source. It should look something like this:

< connectionStrings >
< add name="ApplicationServices" connectionString="Server=tcp: zkymadd998.database.windows.net;Database=alfadb;User ID=jnak;Password =< enter >;Trusted_Connection=False;" providerName="System.Data.SqlClient" />
< add name="AlfaConnectionString" connectionString="Server=tcp: zkymadd998.database.windows.net;Database=betaDB;User ID=jnak;Password=;Trusted_Connection=False;" providerName="System.Data.SqlClient" />
connectionStrings >

Remove database files from App Data and execute.

This shall work just fine.

#ASP.NETapplications #Windows Azure #Cloud #SQL Azure # MS SQL #asp.netdevelopers #webdeveloper
X