Publish Asp.net core 3.1 + database + migration - database

I have created an application on asp.net core 3.1. I have a database and a migration, but when creating a release, there is no migration in the Publish folder. Need step by step instructions.
I have my own server with a local database
enter image description here
Do I need to customize this page
enter image description here

1.Try to install MSSMS and connect to your local server. It's needed to manage your local database:
https://learn.microsoft.com/ru-ru/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-ver15
2.How publish an ASP.NET Core app to Azure with VS:
https://learn.microsoft.com/en-us/aspnet/core/tutorials/publish-to-azure-webapp-using-vs?view=aspnetcore-3.1
3.Deploy local database to Azure portal:
https://www.progress.com/documentation/sitefinity-cms/deploy-the-database-to-azure-sql#create-a-sql-server
4.Use Azure portal. And try a subscription "trial":
https://portal.azure.com/
I'm waiting for your questions.

Related

ASP NET Core application with SQL Server (local) database published on Azure platform

I have created an ASP.NET Core MVC application and published it directly via VS 2022 to Azure. It includes EF and Identity.
What is the best approach to also connect the database with data?
I have connected the database, but that didn't work as expected. All the data is missing
You can deploy your local database to Azure and connect with Web application.
I deploy My local database which is having SQL server authentication by following below procedure:
I selected the database and right click on it I go to below option:
Clicked on Deploy Database to Microsoft Azure SQL Database.
Connected to the Azure database server By clicking on connect option.
Image for reference:
It connected successfully.
Image for reference:
Summary of operation:
I click on finish. The operation started and completed successfully.
Image for reference:
My database is deployed to azure SQL database successfully.
Image for reference:
In this way we can deploy Local database to Azure SQL database.
Connecting to application:
Create web application go to publish page of that
From the View menu, select SQL Server Object Explorer.
At the top of SQL Server Object Explorer, click the Add SQL Server button.
In connect dialog box expand your azure node and connect to the database with username and password
Add client IP
database connected successfully.
In this way you can connect with azure SQL database.

How can I connect my SQL Server database that is placed on another server using API or Web Service in MVC to website that is on a different server

I uploaded my website to GoDaddy web hosting and the database is placed on another server.
I want to create an API - either REST or SOAP - to connect my web site with my SQL Server database.
I need help - how can I create an API in ASP.NET MVC 5 so that I can connect my database with my web site? Kindly provide me with a link or code so that I can solve my issue.
I have never worked on API before - any help will be much appreciated.
ASP.NET MVC is now old school. Try ASP.NET Core.
You need to design and develop an N-Layered application: Data, Service and UI.
It doesn't matter where the database server is sitting, as long as your WebAPI can connect to it.
I suggest you build a restful web api with asp.net core :
https://learn.microsoft.com/en-us/aspnet/core/tutorials/first-web-api?view=aspnetcore-3.1&tabs=visual-studio
Put your db connection string in the app settings file.
Although you use other database server, it doesn't matter. You just need to make sure you check your connection string and point it to your database server. For publishing method, it is same, you can use FTP or Visual Studio
Please open your project with Visual Studio tool
On the Solution Explorer windows (which is normally located on the top right hand corner of the VS tool), right click your project and select Publish
Please kindly publish it to a local folder, such as C:\Project
Please just upload whatever files/folders you see on C:\Project to your server via FTP
If you have any problems, you can contact your support team
You can get the Reference from
Sample_WebAPI_Project ,
instead of Using List created you can create Database Connection and get data from Database

Deploying Umbraco 8.1.1 to Azure w/SQL Azure DB: Boot Failed

I'm trying to develop an Umbraco 8.1.1 site on Azure and am following these steps:
I create an Azure SQL server database (I don't use any local DB at all).
I create an empty ASP.NET 4.7 Web App locally and add Umbraco 8.1.1 via NuGet
I invoke locally and configure my Umbraco application to use the Azure SQL Server DB. It works without issue. I can see the database from SQL Server Management Studio no problem.
I then publish the site through Visual Studio 2019 to an Azure Web App, and when I visit it, I get the following error:
Server Error in '/' Application.
Boot failed: Umbraco cannot run. See Umbraco's log file for more
details.
-> Umbraco.Core.Exceptions.BootFailedException: A connection string is configured but Umbraco could not connect to the database. at
Umbraco.Core.RuntimeState.DetermineRuntimeLevel(IUmbracoDatabaseFactory
databaseFactory, ILogger logger) in
d:\a\1\s\src\Umbraco.Core\RuntimeState.cs:line 194 at
Umbraco.Core.Runtime.CoreRuntime.DetermineRuntimeLevel(IUmbracoDatabaseFactory
databaseFactory, IProfilingLogger profilingLogger) in
d:\a\1\s\src\Umbraco.Core\Runtime\CoreRuntime.cs:line 259 at
Umbraco.Core.Runtime.CoreRuntime.Boot(IRegister register,
DisposableTimer timer) in
d:\a\1\s\src\Umbraco.Core\Runtime\CoreRuntime.cs:line 146
I'm stumped. How do you configure Umbraco to use an Azure SQL DB?
Check that you've got the connection string registered in the Web App correctly - I suggest looking at the Configuration section for the Web App and setting the configuration string there. Alternatively, download your web.config file via ftp and compare the connection string in the published version vs. your local version.
You should also check the server or database firewall settings and make sure that Azure services have access:
https://learn.microsoft.com/en-us/azure/sql-database/sql-database-firewall-configure#connecting-from-azure

Deployment of ASP.NET Core Web application

I am starting to write an open source application which is intended to be deployed on premises with MS SQL Server as backend. Now I was wondering how to go about deploying the application and the SQL Server backend.
For MSSQL there is a pretty clear installation path but I was wondering how I could create an easy installer for the web application. The idea is to copy the website to some location, start it and then call a special installation controller where the user could specify a database user with elevated privileges (such as the 'sa' user). The website should then create some database users, views and tables on that database and perform the initial setup. Additionally, it should also modify the configuration of the website to use the correct database user.
Of course, other ideas are welcome as well. How do you handle the deployment of a website for a small company which doesn't have dedicated IT staff.

Visual Studio web and SQL publish

Here's the scenario:
MVC web project
Three MS SQL Server database projects
One of the databases must be populated with lookup tables
Other tables are user data and don't need data uploading
GoDaddy hosting
Visual Studio 2013
I'd like to deploy everything (web project, sql schemas, reference data) to GoDaddy in one fell swoop, but they appear to only offer FTP uploading. When using FTP in the Web Publishing Wizard, it says "Database preview not supported for this method" which I'm taking "method" to mean FTP. I can publish the web project fine in FTP, but of course without the databases the web application generates errors.
So here are my questions
There is a "Web Deploy" publish method listed in the wizard, but GoDaddy has no information on how to set this up. Can this be used with GoDaddy and will it publish DBs also?
How does one configure the project to use the local SQL Server when running on localhost, but when deployed it uses the GoDaddy SQL Servers?
Can the data in the local DB be uploaded as part of the publishing wizard process, or is SQL Server Management Studio the tool of choice?
Thanks!
I don't believe GoDaddy supports WebDeploy. They didn't when I left their service a few years ago. You can talk to them to confirm whether this has changed.
This is the role of Web.Config Transforms. For an intro to the topic, see here; the article is a little out of date and doesn't mention one of the most useful points - you can add transforms for each publish profile, so they're applied according to your publish settings.
You probably can't upload the local DB file. In almost every hosting situation, the SQL server and the web server are two separate machines, and don't share any files (corollary: the web server doesn't have the SQL service installed). One workaround you can try is to publish the DB directly from your own machine. That is, if you can connect to the DB from your machine, you can do a Web Deploy publish to your own machine but it will send the SQL changes to your GoDaddy DB server.
A more advanced workaround for #3:
Set up your FTP publishing settings for your files
Figure out how to publish your DB through WebDeploy only/from the command line (you can refer to here for a sample using WebDeploy from the command line; note this is going from GoDaddy -> Local, but it's trivial to turn it around)
Customize the web publish pipeline to insert an MSBuild target to execute your WebDeploy command line (see here for an example of modifying the pipeline; you can add the target directly in your .pubxml file if you're not intending to use it for multiple projects).
This will give you a single publish profile which will separately publish your files (via FTP) and your DB (via WebDeploy).

Resources