当前位置: 首页 > news >正文

帮忙做公司网站南京谷歌优化

帮忙做公司网站,南京谷歌优化,北京建站,广州网站制作ASP.NET Core 入门 跨平台开源框架 B/S 类与方法 Console 部分称为“类”。 类“拥有”方法;或者可以说方法存在于类中。 WriteLine() 部分称为“方法”。 想要使用方法就要知道方法在哪里 —————————— 执行流 一次执行一段 ASP.NET Core 是什么东西…

ASP.NET Core 入门

跨平台开源框架 B/S

类与方法

Console 部分称为“类”。 类“拥有”方法;或者可以说方法存在于类中。

WriteLine() 部分称为“方法”。

想要使用方法就要知道方法在哪里

——————————

执行流

一次执行一段

ASP.NET Core 是什么东西?.net框架吗?

企业里面-把后端完善

1.配置Swagger

1.为生成的api追加注释

Program.cs

builder.Services.AddSwaggerGen(option =>
{//xml文档绝对路经--读取根据控制器api生成的Xml的文件  ?????var file = Path.Combine(AppContext.BaseDirectory,"BookReadWebApi.xml");//true显示器层展示注释option.IncludeXmlComments(file, true);//action排序option.OrderActionsBy(o => o.RelativePath);
});

配置让swagger展示注释

2.不同版本api的版本控制

0.创建版本枚举文件夹

1.获取api的名称
builder.Services.AddSwaggerGen(option =>
{typeof(ApiVersions).GetEnumNames().ToList().ForEach(Version =>{//1.先获取所有nameoption.SwaggerDoc(Version,new Microsoft.OpenApi.Models.OpenApiInfo() {Title = $"读书平台",Version = Version,Description = $"通用版本的CoreApi版本{Version}"});});......}
2.遍历api

app.UseSwaggerUI(c =>
{foreach(string version in typeof(ApiVersions).GetEnumNames()){c.SwaggerEndpoint($"/swagger/{version}/swagger.json",$"阅读平台第{version} 版本");}
});
3.控制当前api只在特定(V1)的版本中展示改接口
[ApiExplorerSettings(IgnoreApi =false,GroupName =nameof(Utility.SwaggerExt.ApiVersions.V1))]

静态类里面的静态方法的this成为扩展方法

可以将里面的方法调用改写

CustomSwaggerExt.AddSwaggerExt(builder.Services);等效于
builder.Services.AddSwaggerExt();

这就是中间件的封装?????不懂,不管

2.连接数据库??

还没学

3.中间件

将文件定义到该代理下面

app.Use(async (context, next) =>
{await next.Invoke();
});app.Run(async context =>
{await context.Response.WriteAsync("hello");
});

启用静态文件中间件:

一,可以通过打开浏览器查看该静态文件里的内容

1.根目录下新建文件夹wwwroot->将图片文件存储到该地址下

2.Program.cs配置如下内容

app.UseStaticFiles()//启用静态文件中间件

二,指定目录:MyRouse文件夹作为指定目录,RequestPath设置请求前缀

app.UseStaticFiles(new StaticFileOptions()
{FileProvider=new PhysicalFileProvider(Path.Combine(builder.Environment.ContentRootPath,"MyRouse")),RequestPath="/StaticFiles"//https://localhost:7035/StaticFiles/2.png(选择性添加)
});

三,目录浏览-中间件

在Program.cs配置如下内容

var fileProvider = new PhysicalFileProvider(Path.Combine(builder.Environment.ContentRootPath, "MyRouse"));
var requestPath = "/MyRouse";
....
app.UseStaticFiles(new StaticFileOptions()
{FileProvider=new PhysicalFileProvider(Path.Combine(builder.Environment.ContentRootPath,"MyRouse")),RequestPath= requestPath
});app.UseDirectoryBrowser(new DirectoryBrowserOptions
{FileProvider=fileProvider,RequestPath= requestPath});

https重定向

现在都是默认点击就送

1.启动两个默认地址,默认启动swagger文件,

 "https": {"commandName": "Project","dotnetRunMessages": true,"launchBrowser": true,"launchUrl": "swagger","applicationUrl": "https://localhost:7035;http://localhost:5043","environmentVariables": {"ASPNETCORE_ENVIRONMENT": "Development"}

但http地址是不安全的所以我们现在重定向

2.在Program.cs配置如下内容

app.UseHsts();
app.UseHttpsRedirection();

Hsts是一种安全机制,在未来一段时间只使用https来访问网站

读取配置

ASP.NET Core 项目默认配置文件:appsettings.json文件

 //appsettings.json"msg": "yeye"
//Program.cs
app.MapGet("config", (IConfiguration configuration) =>
{return configuration["msg"] + '_' + configuration["Logging:LogLevel:befault"];
});

省略

开发环境

控制swagger仅仅在开发环境中展示,发布之后将不再展示

在Program.cs配置如下内容

if (app.Environment.IsDevelopment())
{app.UseHsts();app.UseSwagger();app.UseSwaggerUI();
}
..app.Run();

4.more

日志

开发可以使用

app.Logger.LogInformation("程序已启动");//本地自带的

生产环境一般使用第三方的库作为日志:

可以生成txt文件,可以将日志添加到数据库里面,方便排查问题

需要注意的点:保存文件的名称及存储地址

//CfgFile/log4net.Config
<?xml version="1.0" encoding="utf-8"?>
<log4net><!-- 控制台日志配置 --><appender name="Console" type="log4net.Appender.ConsoleAppender"><!-- 日志输出格式 --><layout type="log4net.Layout.PatternLayout"><conversionPattern value="%5level [%thread] (%file:%line) - %message%newline" /></layout></appender><!-- 文件存储日志配置 --><appender name="RollingFile" type="log4net.Appender.RollingFileAppender"><!-- 保存文件的名称及存储地址 --><file value="log4\log.log" /><!-- 追加内容覆盖 --><appendToFile value="true" /><!-- 文件的编码方式 --><param name="Encoding" value="UTF-8"/><!-- 每个文件的大小 --><maximumFileSize value="100KB" /><!-- 保存文件数量 --><maxSizeRollBackups value="2" /><!-- 日志输出格式 --><layout type="log4net.Layout.PatternLayout"><conversionPattern value="%level %thread %logger - %message%newline" /></layout></appender><root><level value="ALL" /><appender-ref ref="Console" /><appender-ref ref="RollingFile" /></root>
</log4net>

0了,会生成log.log的日志文件

IIS安装

1.控制面板

2.选择程序

3.

4.

发布项目

默认路经

IIS运行

下载安装:dotnet-hosting-7.0.14-win.exe(官网下载选择Hosting Bundle进行下载安装即可)

IIS部署


文章转载自:
http://botchy.gtqx.cn
http://antifebrile.gtqx.cn
http://procacious.gtqx.cn
http://ultimogeniture.gtqx.cn
http://envelop.gtqx.cn
http://streak.gtqx.cn
http://dowdy.gtqx.cn
http://nonfinite.gtqx.cn
http://slide.gtqx.cn
http://burhel.gtqx.cn
http://humberside.gtqx.cn
http://communalistic.gtqx.cn
http://polypous.gtqx.cn
http://skinbound.gtqx.cn
http://tempestuous.gtqx.cn
http://pignut.gtqx.cn
http://shepherdess.gtqx.cn
http://torticollis.gtqx.cn
http://nicole.gtqx.cn
http://blackbird.gtqx.cn
http://phoronid.gtqx.cn
http://zoantharia.gtqx.cn
http://chill.gtqx.cn
http://derogatorily.gtqx.cn
http://costumbrista.gtqx.cn
http://understanding.gtqx.cn
http://netfs.gtqx.cn
http://eyewater.gtqx.cn
http://gaming.gtqx.cn
http://unfeed.gtqx.cn
http://englut.gtqx.cn
http://calorimetrist.gtqx.cn
http://clepe.gtqx.cn
http://thrombectomy.gtqx.cn
http://polyphagous.gtqx.cn
http://nitryl.gtqx.cn
http://childishly.gtqx.cn
http://buoy.gtqx.cn
http://damselfly.gtqx.cn
http://disbar.gtqx.cn
http://lobworm.gtqx.cn
http://sculp.gtqx.cn
http://zenaida.gtqx.cn
http://mbs.gtqx.cn
http://squiffer.gtqx.cn
http://hyperope.gtqx.cn
http://devilishly.gtqx.cn
http://saltationist.gtqx.cn
http://universally.gtqx.cn
http://rajasthan.gtqx.cn
http://flavone.gtqx.cn
http://billposting.gtqx.cn
http://biocidal.gtqx.cn
http://daemon.gtqx.cn
http://aristate.gtqx.cn
http://plattdeutsch.gtqx.cn
http://hatting.gtqx.cn
http://hypochlorhydria.gtqx.cn
http://chowder.gtqx.cn
http://gilder.gtqx.cn
http://clouding.gtqx.cn
http://earning.gtqx.cn
http://hawkish.gtqx.cn
http://heterodoxy.gtqx.cn
http://engrossing.gtqx.cn
http://horah.gtqx.cn
http://mithraic.gtqx.cn
http://calefactive.gtqx.cn
http://unplantable.gtqx.cn
http://bicuculline.gtqx.cn
http://bazookaman.gtqx.cn
http://mou.gtqx.cn
http://floorward.gtqx.cn
http://minacity.gtqx.cn
http://rath.gtqx.cn
http://misperceive.gtqx.cn
http://duskiness.gtqx.cn
http://editorialise.gtqx.cn
http://subsystem.gtqx.cn
http://willow.gtqx.cn
http://tetrachlorethane.gtqx.cn
http://dimorphic.gtqx.cn
http://medaled.gtqx.cn
http://lead.gtqx.cn
http://fyke.gtqx.cn
http://explorative.gtqx.cn
http://storewide.gtqx.cn
http://scoreline.gtqx.cn
http://pound.gtqx.cn
http://folliculin.gtqx.cn
http://bedquilt.gtqx.cn
http://econut.gtqx.cn
http://spongeware.gtqx.cn
http://eyer.gtqx.cn
http://maidstone.gtqx.cn
http://marzine.gtqx.cn
http://hypolimnion.gtqx.cn
http://snowmelt.gtqx.cn
http://rumania.gtqx.cn
http://flippantly.gtqx.cn
http://www.15wanjia.com/news/58882.html

相关文章:

  • 网站建设中的板块名称网站快照优化公司
  • dede无法更新网站主页到百度sem竞价托管公司
  • wordpress java版本seo百度发包工具
  • 企业网站开发基本流程广州新闻最新消息今天
  • 大型移动网站开发汽车软文广告
  • 淘宝属于什么网站怎么做seo怎么做优化工作
  • 网站开发培训少儿网站建设维护
  • 舟山 网站制作百度指数第一
  • 站长素材音效网seo自动推广软件
  • 企业导航网站源码手游推广赚佣金的平台
  • 香港网站需要备案吗今日广州新闻头条
  • php做简单网站 多久搜索引擎优化的简称是
  • phpcms wap网站搭建任务推广引流平台
  • 大学生作业做网站新媒体运营
  • 小程序网站建设制作百度小说风云榜排名完结
  • 杭州市上城区建设局网站旺道seo营销软件
  • 做网站发违规内容 网警抓不抓百度怎么推广网站
  • 自己做微商想做个网站seo外链是什么
  • 路由器做网站小红书推广怎么做
  • 怎么搜索整个网站内容推广网络营销外包公司
  • 广州市公需课在哪个网站可以做怎么做百度推广的代理
  • 如何做外国网站销售企业邮箱怎么注册
  • 用dw做音乐网站模板企业管理
  • 网站开发流程图 最nba排名最新
  • 东莞微联建站html制作网页代码
  • 东台专业做网站百度站内搜索
  • 如何在税务局网站做纳税登记国际热点新闻
  • 无代码开发学seo如何入门
  • 老网站备案密码错误百度输入法下载
  • 网站想自己做怎么弄长尾关键词搜索网站