当前位置:网站首页>ASP.NET application--Hello World
ASP.NET application--Hello World
2022-08-05 03:06:00 【DXB2021】
安装 .NET and create the first Web 应用程序.
On-premises provisioning wizard and provisioning agent:
下载.NET SDK(软件开发安装包)
打开Windows PowerShell,输入命令行dotnet.
dotnet
运行结果如下:
如果安装成功,则会看到类似于以上内容的输出.
创建应用
在命令提示符,运行以下命令以创建应用:
dotnet new webapp -o MyWebApp --no-https -f net6.0
What does this command mean?
dotnet new
The command will create a new application.
webApp
The parameter selects the template to use when creating the app.-o
参数会创建名为MyWebApp
的目录,用于存储应用.--no-https
The flag specifies that it is not enabled HTTPS.-f
参数指示你正在创建 .NET 6 应用程序.
Which files were created?
已在 MyWebApp
Create multiple files in the directory,To provide you with simple to run Web 应用程序.
Program.cs
Contains application startup code and middleware configuration.Pages
The directory contains some sample web pages for the application.MyWebApp.csproj
Some project settings are defined,For example to be oriented .NET SDK 版本.Properties
目录中的launchSettings.json
file defines different configuration file settings for the local development environment.It is automatically assigned when the project is created 5000-5300 and save it on this file.
运行应用
在命令提示符中,Navigate to the directory created in the previous step:
cd MyWebApp
然后,运行以下命令:
dotnet watch
Wait for the app to show listening http://localhost:<port number>
and wait for the browser to start at that address.
Congratulations on building and running your first one .NET Web 应用!
选择Ctrl+C,to stop the application at any time.
编辑代码
编辑代码
Open in any text editor at Pages
目录中的 Index.cshtml
文件.
before entering the code:
代码如下:
@page
@model IndexModel
@{
ViewData["Title"] = "Home page";
}
<div class="text-center">
<h1 class="display-4">Welcome</h1>
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
</div>
After entering the code:
代码如下:
@page
@model IndexModel
@{
ViewData["Title"] = "Home page";
}
<div class="text-center">
<h1>Hello,world!</h1>
<p>The time on the server is @DateTime.Now</p>
</div>
运行结果:
代码如下:
@page
@model IndexModel
@{
ViewData["Title"] = "Home page";
}
<div class="text-center">
<h1 class="display-4">Welcome</h1>
<h1>Hello, world!</h1>
<p>The time on the server is @DateTime.Now</p>
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
</div>
运行结果如下:
边栏推荐
- Tencent Cloud [Hiflow] New Era Automation Tool
- mysql没法Execute 大拿们求解
- 数学-求和符号的性质
- 1527. 患某种疾病的患者
- Turn: Charles Handy: Who you are is more important than what you do
- mysql can't Execute, please solve it
- Use @Mapper to query the partition status of oracle and report an error
- 冒泡排序与快速排序
- 论治理与创新,2022 开放原子全球开源峰会 OpenAnolis 分论坛圆满落幕
- Lexicon - the maximum depth of a binary tree
猜你喜欢
Countdown to 2 days|Cloud native Meetup Guangzhou Station, waiting for you!
Matlab画图3
Is your data safe in this hyperconnected world?
Beidou no. 3 short message terminal high slope in open-pit mine monitoring programme
引领数字医学高地,中山医院探索打造未来医院“新范式”
ASP.NET应用程序--Hello World
论治理与创新,2022 开放原子全球开源峰会 OpenAnolis 分论坛圆满落幕
为什么pca分量没有关联
【 genius_platform software platform development 】 : seventy-six vs the preprocessor definitions written cow force!!!!!!!!!!(in the other groups conding personnel told so cow force configuration to can
CPDA|How Operators Learn Data Analysis (SQL) from Negative Foundations
随机推荐
torch.roll()
The 20th day of the special assault version of the sword offer
The usage of try...catch and finally in js
Apache DolphinScheduler, a new generation of distributed workflow task scheduling platform in practice - Medium
STM32 uses stm32cubemx LL library series tutorial
[In-depth study of 4G/5G/6G topic-51]: URLLC-16-"3GPP URLLC related protocols, specifications, and technical principles in-depth interpretation"-11-High reliability technology-2-Link adaptive enhancem
北斗三号短报文终端露天矿山高边坡监测方案
使用二维码传输文件的小工具 - QFileTrans 1.2.0.1
Physical backup issues caused by soft links
语法基础(变量、输入输出、表达式与顺序语句)
J9 Digital Currency: What is the creator economy of web3?
引领数字医学高地,中山医院探索打造未来医院“新范式”
告白数字化转型时代,时速云镌刻价值新起点
Study Notes-----Left-biased Tree
How Jin Cang database correctness verification platform installation file
Flink 1.15.1 Cluster Construction (StandaloneSession)
Turn: Charles Handy: Who you are is more important than what you do
View handler stepping record
The Tanabata copywriting you want has been sorted out for you!
Syntax basics (variables, input and output, expressions and sequential statements)