Migrating the ASP NET application to Windows Azure for newbies is a challenging task. However, with little patience and meeting prerequisites, you can handily replenish this otherwise which is a demanding task.
Before you start, make sure to have an active Azure account and a working SQL Azure Database.
If you don’t have one, set up a new account at the 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 ASP NET application from running.
Microsoft Azure lets you focus on business ideologies while Azure takes care of the foundation and open-ended maintenance to manage the apps.
Moving ASP.NET Apps to Azure
- Migrate the alfa.MDF (application)
- Migrate ASP.NET application development service providers
- Change the connection strings
1. Migrating Alfa.MDF
ASP.NET MVC 5 introduces attribute routing, which allows you to define routes using attributes on actions and controllers. This feature provides more flexibility and control over routing.
- 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.
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.
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 the 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. You can also explore our ASP.NET Development Services, and certified ASP.NET developers For more information.
Unlock Excellence in MAUI and Xamarin Mobile App Development with Top Xamarin Application Developers. Harness cross-platform capabilities for unique results.
The best ASP.NET Core Development Company that helps businesses to build their online presence. Our ASP.NET Core Development Services are your 1-stop solution.
Hire AbleCommerce Developers for ultimate e-commerce development experience. We are outsourcing AbleCommerce Development services by creating awesome e-stores.
Are you looking to hire Xamarin Developers? Then hire Xamarin app developers who have been working in the web app development industry for more than 15 years.