Click here to Skip to main content
13,624,686 members
Click here to Skip to main content
Add your own
alternative version

Stats

7K views
10 bookmarked
Posted 28 Dec 2017
Licenced CPOL

Hosting Your MVC Application in Cloud with DataBase Migration from Local to Azure

, 28 Dec 2017
Rate this:
Please Sign up or sign in to vote.
This article is completely dedicated on deployment of Web Application in Cloud(Azure),with a brief introduction on Data Migration and its Tools, for migrating local database to cloud DB.

Introduction

When we consider cloud we might have suddenly something like sky and cloud in our mind right!!!!!. Yes that was my feeling when i heard this term  very first time ,but now i got a new picture in my mind when someone speak about cloud. So before entry into our main topic, i will give some light on what cloud  computing is and then i will proceed to the deployment job in cloud.

In our traditional approches we go for Physical space,Server,Storage,Database,networking,hardware,software all these stuffs with some professionals who can regurlarly work and look  into it for hosting an application.It also does not provide features like scale up,scale out automatically.If we want to do these we need to  do it manually say by buying some hardware,memory,etc with some high professional members who can look into it. It does not support disaster management.

So Cloud computing introduced to overcome such problem of Traditional approches and it is the delivery of Computing services like Server,Storage,Database,networking,hardware,software,etc over internet("Cloud").

It provide features like Vertical Scaling or Scaling Up.Scaling vertically is done by adding more resources to an existing work unit.  For example, let’s say your web server is starting to underperform.
There are many ways to improve its scalability via vertical scaling.  Adding more memory, cache, disk, or processors is one way. 

one more  option that cloud provide  is  to leave the existing machines in place, and add some additional machines to the work Unit to share the burden. This stratgy is called scaling out or horizontal scaling.

so this is the Quick introduction on cloud computing if i will try to write about the benifits of cloud then belive me it will only cover the full topic. 

There are lots of compnies who are providing computing services, some of the well known companies are-

  • Amazon Web Service
  • Microsoft Azure
  • Google Cloud Platform
  • IBM cloud

     

So here we will particuarly target to a "Microsoft Azure" to perform our work.

 

Table of contents

  • Introduction to Azure Portal
  • Creating Sql Server Database in Azure
  • Introduction to Data Migration Assistant Tool.
  • Migrating the Local sql server Database to Azure Database
  • Working with MVC(HMS) Project.
  • Deploying the MVC project In Azure
  • Testing Functionality of Hosted Site.

Introduction to Azure Portal

To work of diffrent kind of computing services provided by Azure,it has a web interface called the Azure portal that allows administrators to access and manages various kind of computing services.The Microsoft Azure portal is a central place where you can provision and manage your Azure resources. This tutorial will familiarize you with the portal and show you how to use some of these.

To work in with this Portal you have to create an account in this portal.It provide 30 days trail pack with Rs 13300 creadit limit to a normal test on this account.The credit is valid for 1 month only and will expire after  month,and one more thing this is actually based on your using the credit limit start deducting on the basic of of using of resources in Portal.

Once you create an account,it will ask for free subscription,It will take your Credit Card or DabitCard detail for subscribe your free balance.

I have collected few links if any one want to know more about the service,can ckeck the link.

So the first step is to create a DataBase for the application we want to deploy.Note we have already have some database schema ,we just need to migrate them.

So here is the procedure to create a new Database in azure

Create a new Database in Azure

To create a new database in Azure please follow the below points.

  • Log in to the Azure portal.
  • Select SQL Databases from the  page, and then  select Create rSQL Database as shown below.

 

 

  • Fill out the SQL Database form with the following information, as shown on the image below:



    Note:-There are some restriction on naming convention,you should follow there rules where creating it.

Here is the server details clearly mentioned.


Note:-For azure we have 3 data center in india,these are-

  1. Central India-Pune
  2. West India-Mumbai
  3. South India-Chennai



As we are from Bangalore,so the south india data center is nearer to us,thats why here the location we choosed is South India.

If any one is not clear about datacenter let me explain this.

A DataCenter is a dedicated centrailized location where all the computing and networking equipment are provided for collecting,storage and management of large amount of data.These data center have features like.

  1. Dedicated space for housing infrastracture.
  2. High bandwidth internet provider.
  3. Efficient air cooling system.
  4. Dust free enviroment.
  5. High physical security.
  6. Disaster Management.
  7. High qualified,high professional members who can look into it

 

  • Once every thing you filled in that database form click Create button to create a database.
  • Once the database is done you need to specify the Firewell rules.Initially, all Transact-SQL access to your Azure SQL server is blocked by the firewall.
     To begin using your Azure SQL server, you must specify one or more server-level firewall rules that enable access to your Azure SQL server. 
    To set a server-level firewall rule from the database overview page, click Set server firewall on the toolbar as shown in the following image: The Firewall settings page for the SQL Database server opens.


    Thats all now you have successfully created your database.
    Before hosting any application to the cloud actually the development process normally starts from local machine(eg.from your local Visual studio and SQL Server).Similarly  i have created  my database and project in my local machine.Here is the database structure in my local machine.

Introduction to Data Migration Assistant Tool

Data Migration Assistant is a tool for migrating our local database to azure sql server.DMA is a valuable tool and has a lot of features to help you in successful SQL Server Migration. DMA analyzes your source SQL Server instance against your target SQL Server instance (newer/upgraded version) and prepares a comprehensive report to tell you how you will be able to achieve your migration successfully.
Here are the some steps to migrate the data.

  1. For use Data Migration Assistance(DMA) tool you need to download the tool.You can download the tool from here.
  2. Once you download the setup ,please install it in your local Pc.Once you installed click to start.

     
  3. Give a project Name and put the source DB type and Target DB type to start.Click create to start.



    After that fill all the source(your local sql database details) and click connect to see all the databases in the screen.
  4. Now second thing is to select your database want to migrate(HMS).
  5. Now enter the Target server details for connecting the target details.

  6. Once all done ,select the db objects to be migrate.
  7. Now click the Generate script to generate the script.
  8. See all the data in the screen apper.
  9. Now Click the Migrate button to select the table for Migration.







  10. After that Start Migration.




    Thus your data is migrated completely to your Azure SQL database.Now Login with your Azure server detail in Sql server to see the Database in Azure.

     
  11. Check the Dabebase it created will all scheme structure.

    Now to check the data, write a simple query.


    Thus the data is completely migrate to Azure.
     

    Creating AppService

    Azure Web Apps enables you to build and host web applications in the programming language of your choice without managing infrastructure. to create web apps search for web apps in portal and select it.

    Now after creating It will give some application info ,just note down and save it.

Working with MVC(HMS) Project

Here i have given the full description of Hospital Mangement Project(HMS),If any one want to explore it here is the link provided.
https://www.codeproject.com/Articles/1202183/Creating-Real-Time-MVC-Projects-Step-by-Step-with

Iclinic or HMS is a platform which bridges the gap between the doctors,patients and clinic. This platform is concerned about end to end consultation between the  doctors and patients via the medium of digitating clinical Ticketing system.
In order to achive this facility we have  provided a portal where a patient can register his symptoms,get a online ticket, later can consult with any of the collabarated clinic.During his/her visit to clinic they need to quote the registration id which will be later process by doctor.

here is the complete project structure in my Local machine.

Change the connection string from local to the Server machine.I have done this basic modification in my projects.

Now Right click and Publish the Project

Deploying the MVC project In Azure

Publish the project as shown below.

Here you will get the following options while publishing your project.



Choose Microsoft Azure App Service and click on Publish Button

Note you should login to your Azure account while Publishing this.It will automatically take your Web app name and required fields.

Once done it will automatically started and will automatically browsed.
​​​​​​

Conclusion

Hope you will like this explanation,if you have any doubt in this you can comment or reach me in my mentioned email id.If yu have any suggestation regarding any work,please let me know so that even i will lern from you.

History

Initial Release-28-Dec-2017(Last article of 2017).

Wishing U all Happy New Year in Advance!!!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Debendra0256
Software Developer
India India
Achievements:

* C# Cornor MVP-2015
* C# Cornor MVP-2016
* C# Cornor MVP-2017 


You may also be interested in...

Pro
Pro

Comments and Discussions

 
GeneralGood Article Pin
Alireza_136213-Feb-18 11:02
memberAlireza_136213-Feb-18 11:02 
QuestionData migration from local to Cloud Excellent Pin
Member 136053933-Jan-18 6:08
memberMember 136053933-Jan-18 6:08 
QuestionReally the config section Needed Pin
ShyamDotnet102-Jan-18 4:11
memberShyamDotnet102-Jan-18 4:11 
QuestionService and DB Pin
Alex (RSA)1-Jan-18 23:42
professionalAlex (RSA)1-Jan-18 23:42 
AnswerRe: Service and DB Pin
Debendra02562-Jan-18 15:12
memberDebendra02562-Jan-18 15:12 
QuestionNice Post Pin
Member 132935451-Jan-18 17:41
memberMember 132935451-Jan-18 17:41 
QuestionWell explained article Pin
Member 1178312030-Dec-17 5:54
memberMember 1178312030-Dec-17 5:54 
AnswerRe: Well explained article Pin
Debendra025630-Dec-17 7:02
memberDebendra025630-Dec-17 7:02 
Questiongood article but Pin
Bheesham Kumar Sharma29-Dec-17 2:20
memberBheesham Kumar Sharma29-Dec-17 2:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web04-2016 | 2.8.180712.1 | Last Updated 28 Dec 2017
Article Copyright 2017 by Debendra0256
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid