How to Upload Visual Studio Project to Smarterasp
This article contains the most detailed steps for publishing ASP.Net Core web awarding to our web server using Visual Studio 2019.
1. Initial Setup at SmarterASP.net
Create a website and a SQL Server database from your hosting Control Console. For more details, delight check the below links
- Create a website
- Create a database
In the section following nosotros will review some of the particular of the setup in club to get the values to need to publish the project
ii. Creating the Project in Visual Studio
Build the project using the Visual Studio templates:
Since all your sites are using the aforementioned application puddle in the hosting programme, please use OutOfPorcess hosting model for all your ASP.NET Core applications.
You lot tin easily configure the setting in local VS, this volition publish the application every bit OutOfProcess hostingModel automatically.
Please annotation, in this example, Individual User Accounts is selected for Hallmark. This ways that the default build will include a database context "ApplicationDbContext" and a migration for creating the Identity Schema. Once the project is created and the command "Update-Database" is run in the VS Package Manager Console, a local database instance is created with a set of tables associated with the user identity. These tin be seen by viewing the "localdb" in the VS SQL Server Object Explorer.
It is non a requirement to apply individual user accounts, even so, if the project does not, information technology will be necessary to create a database context, add ane or more data object, and run the "Add-Migration Initial" and "Update-Database" commands in the VS Package Manager Console in order to demonstrate the steps involving the database.
3. Preparing to Publish the Project
In that location are several critical, and somewhat ambiguous, values that need to exist entered into the VS Publish dialogs and it is useful to collect these in advance.
For more details on how to discover Web Deployment Information The database connection string tin be found by selecting the "Databases" icon from your Command Panel, and then the "Connectedness String Examples". Use the option titled "ASP.NET".
Note that this string includes the user proper noun and password credential for the database (not to exist confused with those of the site.) Your user name will be shown correctly but y'all will need to fill up in your password.
Database Connectedness String: The database connectedness that will be used later on the site is published. Note that this value is not stored in the project file "appsettings.json", which stores the "Default Connection" to the local database.
For more details on how to observe your database connectedness string
four. Publish the Project
Right-click on the project name in the VS Solution Explorer and select Publish from the context menu.
Enter the existent password and check "Save password", click "Validate connection" button, in the upcoming window, click "Take".
Press the Next push to get to the second screen. On the 2nd screen, take default values:
Configuration: Release
Target Framework: net5.0
Deployment Mode: Framework-Dependent Note: yous can cull 'Cocky-Contained' if the cadre version is not installed on the server.
Target Runtime: Portable
Aggrandize the lists on the second screen and check all of the boxes on both screens. Annotation that VS may fill up in the database field(s) with the local connectedness. This is incorrect; both the Databases and the Entity Framework Migrations text fields should comprise the path to the database on the server, as you got from step #3.
If you get the error "ERROR_CERTIFICATE_VALIDATION_FAILED", please re-validate the connectedness in the previous captured "Publish Connection" window, or add together the post-obit line in .pubxml file.
<AllowUntrustedCertificate>true</AllowUntrustedCertificate> If you want to set value of ASPNETCORE_ENVIRONMENT while deploying, please add the following line in .pubxml file.
<EnvironmentName>Production</EnvironmentName>
Once you take created a profile you lot can reuse it every time that you publish by simply running the Publish command.
Observer the Output window in VS to see if the publication worked properly.
Source: https://www.smarterasp.net/support/kb/a2135/how-to-publish-asp_net-core-web-application-via-visual-studio-2019.aspx
Postar um comentário for "How to Upload Visual Studio Project to Smarterasp"