- ASP.NET Core 2 High Performance(Second Edition)
- James Singleton
- 386字
- 2021-07-08 09:39:07
Creating your first app
Run the following command to create a new console app from a template:
dotnet new console -o DotNetCoreTwoHelloWorld
Then switch to the directory that was just created and run it with these two commands:
cd DotNetCoreTwoHelloWorld
dotnet run
Your console should look something like the following screenshot (if you're using PuTTY on Windows):

Assuming that the basic console application worked, let's create a web app. Run the following commands to move up a level to the parent folder and list the templates:
cd ..
dotnet new
Without any additional parameters, the dotnet new command will list all the available templates. These are shown in the following screenshot:

Let's make a standard MVC web app like we did in our other previous examples. The next three commands will create a new web app from a template, switch to the folder created, and run the app:
dotnet new mvc -o AspNetCoreTwoMvc
cd AspNetCoreTwoMvc
dotnet run &
We're executing the app in the background (with &) so that we can use the terminal while it is still running. You could connect to your server with a browser on your local machine, but this would require binding the web server to the external IP address and opening ports on the server and cloud firewalls.
Let's very simply test whether our web server is working by downloading the home page with the following command. If you don't have wget installed, then you could use curl instead:
wget localhost:5000
This process is shown in the following screenshot:

We can view the source of the home page with a command-line text editor, like so:
nano index.html
You will now see the HTML source of the default home page, as shown here:

To tidy up, we should end the dotnet process that is still running. You can use the kill command to end the process with the ID shown when you started it. If you can't find the ID, then you can use ps x to list the processes that are running.
- R語言數(shù)據(jù)可視化之美:專業(yè)圖表繪制指南
- 樂高機(jī)器人設(shè)計(jì)技巧:EV3結(jié)構(gòu)設(shè)計(jì)與編程指導(dǎo)
- R大數(shù)據(jù)分析實(shí)用指南
- 全棧自動(dòng)化測(cè)試實(shí)戰(zhàn):基于TestNG、HttpClient、Selenium和Appium
- Angular開發(fā)入門與實(shí)戰(zhàn)
- Programming with CodeIgniterMVC
- Extending Unity with Editor Scripting
- Visual Basic語言程序設(shè)計(jì)基礎(chǔ)(第3版)
- Laravel Design Patterns and Best Practices
- JavaScript Concurrency
- 微信小程序開發(fā)邊做邊學(xué)(微課視頻版)
- Getting Started with RethinkDB
- Building Web and Mobile ArcGIS Server Applications with JavaScript(Second Edition)
- Implementing NetScaler VPX?(Second Edition)
- AngularJS by Example