项目组成说明
1.launchSettings.json
launchSettings.json里面记录了网站运行时的配置。
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:45224",
"sslPort": 0
}
},
"profiles": {
"PersonalSoftwareDevelopmentRecordWebsite": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5009",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
最常用的applicationUrl地址,一个是IIS运行的地址,一个是项目运行的地址。
2.wwwroot
在wwwroot里面可以存放我们的css,js,image等一些资源,以及.net框架给我们封装好了一些可直接调用的资源在lib文件夹下的bootstrap,jQuery可以说非常方便,里面有bootstrap的官网案例。
注意:在wwwroot下的资源路径调用
"~/xxx"代表在wwwroot文件夹下的资源,例如调用wwwroot文件夹下的图片路径:
<img src="~/images/ghs.png" />
还有利用bootstrap框架搭建的轮播图代码:
<div id="carouselExampleCaptions" class="carousel slide" data-bs-ride="carousel" data-bs-touch="false">
<div class="carousel-indicators">
<button type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Slide 1"></button>
<button type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide-to="1" aria-label="Slide 2"></button>
<button type