Web App and Database Host on Azure - asp.net

Hy Guys,
I'm new to Asp.net and Azure. I was working on ASP.NET with the help of this documentation link, When I publish my project on Azure by creating the Web App with latest portal on Azure, but it is only my application host on the Azure. And now i need to publish the my project database to Azure. In the present portal, the database option is not present there when we create the Web App on Azure to host the database as well with the Web project. But in the old portal as the documentation link guides us the database option is also present there when we publish our Web project on Azure.
Can anyone explain me how can i deploy my Web App existing database to Azure even if my Project has been deployed on Azure?

How can I deploy my existing Web App Database to Azure on the new portal.
If you use Code First Model of Entity Framework, you could just configure the connection string for your web application when you publish your web application. Entity Framework will generate tables for you automatically.
If there are existing data in your database which you want to migrate to Azure SQL Database. You could download a tool named Migration Assistant which will help you do it. For detail steps, link below is for your reference.
SQL Server database migration to SQL Database in the cloud
In the documentation he is using the old dashboard of Azure in which database option is attached with the Web App Publish procedure.
A small difference between old dashboard and new dashboard is that the creating Azure SQL Database feature is hidden when you create your app service. You need to click Explorer additional Azure services link to open the a new window for creating Azure SQL Database.
After creating a database, you could choose the database in the Setting tab when you publish your web application.
You also could create a database directly in Azure portal. After creating a database, you could get the connection string from the overview page.
If you make changes to a database schema and are using code first EF, will EF update your database schema when you redeploy your web app?
It depends whether you have enabled and run the migration. In the publish setting window, we could click the [Execute Code First Migrations] button to update the database schema .
If this button is disabled in the setting window, we need to run Enable-Migrations command in Package Manager Console.
In Visual Studio click menu Tool -> NuGet Package Manager -> Package Manager Console, input Enable-Migrations and run it.

Related

Deploy existing data on ASP.NET web project from local database in Visual Studio to Azure database

I've successfully deployed my ASP.NET project to Azure but the database has been deployed with no data, consequently throwing internal server errors due to functionality requiring that data. I can't see the exact error message as I'm unable to disable customErrors on my project (there's no webconfig file on Razor Pages)
I need to update my database on Azure with the data currently stored locally. How do you do this and is this possible?
N.B - I am using EF core with code-first migrations for data access
On the local machine open the "Microsoft server SQL management studio", connect to the local database server and navigate to the appropriate database. Rightclick on the database name and select "Generate scripts...". Select the tables you want to export, then click "next>". On this screen click the "Advanced" button, scroll down to "Types of data to script" and select "Data only". Now you can generate the script and copy that to a connection to the Azure DB, that can be an other query in de Management Studio or in the Azure portal.

Migrating ASp.net webform based websites to Microsoft Azure

I have to migrate asp.net webform & asp.net MVC websites to Microsoft Azure and most of the webform based website have been created as "website project" in visual studio. and all website use MS SQL Server 2008 R2 as database plus all website use either .net Framework 4.0/4.5.
I confused by reading article regarding migrating webform based website to Azure not working and need code changes and if we use Azure database then we cant use stored procedures etc... this has confused me alot.
So i have few question regarding this.
Can i move asp.net webform 4.0 based website directly to Azure without making any code changes assuming we are connecting to external SQL SERVER 2008.
For first step can which MS SQL Server database i need to choose on Azure so that i can easily restore database in Azure and connect to this database from my local machine using MS Management Studio..
I have heard lot about Azure store files as blob and we need to make change to code to point to new path. What is this Azure blob and why do we need to change code for pointing them blob.
What i have to do keep allowing users from uploading images & document without making any changes in the code..
Does Azure website have always 1 instance running or multiple instance running, i am asking this as our website use InProc session state will i lose session if it is ruuning on multiple instance. or should we prefer SQL Session state in Azure enviroment.
What i should take into consideration for migration current website to Azure.
Will copy pasting all the files in Azure work. Please advise
Depending on how old the ASP.NET webforms projects are, you are going to need to bring them up to date with current security, and anti forgery tokens, etc.
Also if the project was previously a "Website" and not a "Web Application", this is also something that you will need to take into consideration!
I am currently working on upgrading a website to a web application.
This might be a useful website to look through
http://www.gregthatcher.com/Azure/Ch7_ConvertWebsiteToWebApplication.aspx
Migrating to Azure is easy ,
create a Azure account and create the web app which you want to host or create.
you can deploy using FTP or use the build and deploy feature in TFS account.
Steps
You need to create web app in your account.
create a DB in azure manually or export your DB to azure from Management studio if you have an existing DB
get the Connection string from the Publish profile from Azure.
Setup the storage account if you want to store files ,images etc.

Deploying ASP.NET Core solution with class library to Azure

I'm working in VS2015 and have a ASP.NET Core solution with two projects - an API Web Project and a Class Library that holds all the data entities, context and Entity Framework migrations. The API project references the class library and all works well on my local machine.
I now want to deploy the solution to Azure and this is where I'm hitting the problem. If I right click on the API project and go through the Azure App Service publish wizard, on the Settings tab I expand Databases and the message is "No databases found for this project" - which I'm guessing is because it can't find a context as it's not in this project.
If I do the same on the CL project though, there is no Azure App Service deployment option, the only option is File System and clearly there's no option to create the database there either.
So, in summary, my question is how I can deploy this type of solution to Azure and have the database created and migrations applied?
I think you need to create the DB first in the azure and then try to publish your application through the wizard. The database is on your local machine and the application will work just fine on your local environment. But on the cloud you have to first create the database on Azure SQL. Then you need to get the SQL connection string from the portal and update your config file accordingly. Once this is done you can then publish your application from Visual Studio. Please note that the wizard will still not show you the databases, but the application, when configured properly will run fine.

Create new ASP.NET 5 project for existing Azure App Service

I've finally gotten around to familiarizing myself with Azure. I've created several App Services on a new App Service Plan. I've created a SQL Server instance and a SQL Server DB. My intention is to create new MVC sites, one for each App Service I created. I got the Azure SDK all set up and went about trying to create my first site, but now I'm stuck. It seems Microsoft expected me to create the projects in Visual Studio first, and allow the Azure SDK to create a corresponding App Service in Azure for the new projects. This isn't what I've done. So, I've encountered a screen where Visual Studio is asking me to put in details (Web App Name, Resource Group, App Service Plan) for the new App Service, but it doesn't let me choose from a list of existing App Services.
How can I associate the project I'm creating in Visual Studio with the existing App Service I already created in the Azure Portal?
This is the dialog I encountered while creating a new Web Application in Visual Studio and selecting the option to host in Azure. Notice there's a text box to enter a new App Service (Web App) name, but no drop-down to select previously existing App Services.
Azure Web Apps can be created in either direction. You should be able to create them either via Visual Studio or directly in the Azure Portal.
I'm assuming that you've already performed the following steps:
In Solution Explorer, right-click web app project.
In popup menu, select "Publish"
Select Azure subscription to see if any Web Apps exist.
From here on forward, you should be able to create a new Web App or select an existing Web App. Since you're not seeing your existing Web App, let's try to troubleshoot.
In the Publish dialog, create a new Web App (in Visual Studio).
In the Azure Portal, check to see if that Web App was created.
In case you have more than 1 subscription (e.g. free, BizSpark, MSDN from work), this will confirm whether you're looking at the same subscription in both places.
I've included a screenshot below to show you that I have multiple subscriptions, each of which contains a different set of Web Apps.
Hope that helps!

umbraco deployment in azure websites and sql azure

I am new to umbraco and I tried to create an application using it . I created an empty mvc application in visual studio 2013 and add UmbracoCms nuget package( Version 7.1.4). When I ran the app it asked for installation and is successfully installed in a local SQL CE database.
I added the required Controller ( inheriting SurfaceController) and the model required in my partial view . The project compiled and the page worked fine.
Now I need to deploy this site to Microsoft azurewebsites. When I publish the site from visual studio publish option(I specify the website name, sql azure db name and credentials ) to azure the whole publish process gets successfully done. When I browse the site it goes the page that reads "Looks like there's still work to do" and when I click the "Set up your new website" button it goes to the login page "http://XXXXX.azurewebsites.net/umbraco#/login/false". I don't have the credentials since this is a new deployment and I also tried the local one but it did not work either. I believe that the sql azure db is not setup for this. I was of the opinion that when I run the site it willl take me to the installation page . But it did not.
Any help on this would be really appreciated.
Thanks.
Since you installed umbraco locally with SQL CE the web.config gets updated with the current version (its an appSetting) and a connection string. When you then deploy that to Azure it will look like the site is already setup.
Now, I don't know if you included the SQL CE database in your deployment package because with that the site would work (with the credentials you choose locally). But ideally you'd want to set it up with a SQL azure database. To do this you can "reset" the umbracoDbDsn connection string in web.config and remove the version in appSettings. Doing that will make Umbraco start the installation when deployed to azure.
In the umbraco installer you simply choose Customize to get the dialog that always you to enter a connection string for SQL azure.

Resources