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

kubernetes wordpress高手优化网站

kubernetes wordpress,高手优化网站,做放单主持的网站,美女做暧暧视频网站ASP.NET Core中间件组件是被组装到应用程序管道中以处理HTTP请求和响应的软件组件(从技术上来说,组件只是C#类)。 ASP.NET Core应用程序中的每个中间件组件都执行以下任务。 选择是否将 HTTP 请求传递给管道中的下一个组件。这可…

ASP.NET Core中间件组件是被组装到应用程序管道中以处理HTTP请求和响应的软件组件(从技术上来说,组件只是C#类)。
ASP.NET Core应用程序中的每个中间件组件执行以下任务。

选择是否将 HTTP 请求传递给管道中的下一个组件。这可以通过在中间件中调用下一个 next() 方法实现。
可以在管道中的下一个组件之前和之后执行工作。
在ASP.NET Core中,已经有很多内置的中间件组件可供使用,您可以直接使用它们。 如果需要,还可以在ASP.NET Core应用程序中创建自己的中间件组件。
您需要牢记的最重要的一点是,在ASP.NET Core中,给定的中间件组件应仅具有特定目的,即单一职责

中间件执行顺序

ASP.NET Core中间件组件的执行顺序与添加到管道中的顺序相同。 因此,在将中间件组件添加到请求处理管道时

namespace WebApplication2
{public class Program{public static void Main(string[] args){/** WebApplication 表示整个Web应用程序 ,调用CreateBuilder()方法创建一个WebApplicationBuilder 对象。 * */var builder = WebApplication.CreateBuilder(args);// Add services to the container./*WebApplicationBuilder 对象添加 RazorPages 服务 , 也可以添加其他服务,比如依赖注入、   登录等。*/builder.Services.AddRazorPages();//构造一个 WebApplication 实例。var app = builder.Build();// Configure the HTTP request pipeline.if (!app.Environment.IsDevelopment()){//异常处理中间app.UseExceptionHandler("/Error");}//启用静态文件中间件,加上这行代码后, 我们在浏览器中才能访问 wwwroot 目录下的文件,否则会报错。app.UseStaticFiles();//启用路由中间件,启用后在浏览器中输入网址 Web应用才能正确解析app.UseRouting();//启用权限验证中间件,当我们的网站是基于身份认证的话需要用到,//一般购物网站都需要启用,如果只是纯展示性的比如企业官网等可以去掉。app.UseAuthorization();//启用Razor Pages中间件,如果是MVC应用,则使用 app.UseMvc(); 中间件。app.MapRazorPages();//启动应用,当我们开始执行WebApp , 浏览器就会帮我们打开网站 Index 页面了,app.UseEndpoints(endpoints=>{endpoints.MapGet("/",async context => {await context.Response.WriteAsync("======");});});app.Run();}}
}
定义默认页面 默认查找的顺序
  1. default.htm
  2. default.html
  3. index.htm
  4. index.html

//定义默认页面
app.UseDefaultFiles()
// 可以访问静态文件
app.UseStaticFiles()

》》》必须在启用静态文件中间件之前,先启用默认文件中间件

》》》=================
DefaultFilesOptions options = new DefaultFilesOPtions();
options.DefaultFileNames.clear();// 清空默认的
options.DefaultFileNames.Add(“Default_index.html”);
app.UseDefaultFiles(options);
// 可以访问静态文件
app.UseStaticFiles()

在这里插入图片描述
**注意:**您需要在UseStaticFiles()中间件之前添加UseDefaultFiles()中间件,以便提供默认文件。 您需要记住的一点是UseDefaultFiles()中间件只是URL重写器,它永远不会提供静态文件。 该中间件的工作是简单地将传入URL重写为默认文件,然后由静态文件中间件提供服务。

在这里插入图片描述

》》》 UseFileServer 包含了 UseStaticFiles、UseDefaultFiles 功能

FileServerOptions options = new FileServerOptions();
options.DefaultFilesOptions.DefaultFileNames.Clear();
options.DefaultFilesOptions.DefaultFileNames.Add(“Default_index.html”);
app.UseFileServer(options);
UseFileServer它将静态文件中间件、默认文件中间件的功能结合起来啦。 注意UseFileServer 默认不启用目标浏览,但是支持修改此行为

添加 自己 MIME 类型

经典Asp.net web 应用程序,添加缺少的 MIME类型是在IIS内执行的配置任务,但是,在Asp.Net Core 应用中,IIS(以及其它平台上的Web服务器)只是作为反向代理,将传入的请求简单的转发给 Asp.net core 内置的Web服务器(kestrel),请求将从这里开始穿过请求管道。不过,必须通过代码配置这个管道。

            StaticFileOptions options =new StaticFileOptions();var provider = new FileExtensionContentTypeProvider();// 添加自定义的MIME类型provider.Mappings[".myextension"] = "application/my-custom-type";provider.Mappings[".script"] = "text/javascript";provider.Mappings.Remove(".png");options.ContentTypeProvider = provider;app.UseStaticFiles(options);

Use、Run

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

UseEndpoints 终点中间件

在这里插入图片描述

wwwroot

在这里插入图片描述


文章转载自:
http://dinncodesign.tqpr.cn
http://dinncosylph.tqpr.cn
http://dinncofogless.tqpr.cn
http://dinncoimperceptibly.tqpr.cn
http://dinncosiffleur.tqpr.cn
http://dinncoantisocial.tqpr.cn
http://dinncohomopolarity.tqpr.cn
http://dinncophenomenize.tqpr.cn
http://dinncooblige.tqpr.cn
http://dinncohemialgia.tqpr.cn
http://dinncocontrasuggestible.tqpr.cn
http://dinncoeloquent.tqpr.cn
http://dinncorectorial.tqpr.cn
http://dinncomegaversity.tqpr.cn
http://dinncoshreveport.tqpr.cn
http://dinncocystamine.tqpr.cn
http://dinncoburnous.tqpr.cn
http://dinncomucinolytic.tqpr.cn
http://dinncomachinist.tqpr.cn
http://dinncosamdwich.tqpr.cn
http://dinncochaudfroid.tqpr.cn
http://dinncoaffidavit.tqpr.cn
http://dinncodemoralize.tqpr.cn
http://dinncokrebs.tqpr.cn
http://dinncooff.tqpr.cn
http://dinncocreamer.tqpr.cn
http://dinncoregionalization.tqpr.cn
http://dinncoattendee.tqpr.cn
http://dinncoingroup.tqpr.cn
http://dinncooutwinter.tqpr.cn
http://dinncoaffectionately.tqpr.cn
http://dinnconightclothes.tqpr.cn
http://dinncoapprove.tqpr.cn
http://dinncosnafu.tqpr.cn
http://dinncoferberite.tqpr.cn
http://dinncobeethovenian.tqpr.cn
http://dinncoflexible.tqpr.cn
http://dinncoimid.tqpr.cn
http://dinncointerfuse.tqpr.cn
http://dinncostaffman.tqpr.cn
http://dinncoungula.tqpr.cn
http://dinncosummerly.tqpr.cn
http://dinncoreceivership.tqpr.cn
http://dinncohock.tqpr.cn
http://dinncoabsolvable.tqpr.cn
http://dinncopterosaur.tqpr.cn
http://dinncotianjin.tqpr.cn
http://dinncomicrite.tqpr.cn
http://dinncopicescent.tqpr.cn
http://dinncovenery.tqpr.cn
http://dinncogoodliness.tqpr.cn
http://dinncovicissitudinous.tqpr.cn
http://dinncoamnestic.tqpr.cn
http://dinncobeloid.tqpr.cn
http://dinncopyaemic.tqpr.cn
http://dinncoevening.tqpr.cn
http://dinncovera.tqpr.cn
http://dinncowatercraft.tqpr.cn
http://dinncoborrowing.tqpr.cn
http://dinncocercis.tqpr.cn
http://dinncokingstown.tqpr.cn
http://dinncofortuitist.tqpr.cn
http://dinncosept.tqpr.cn
http://dinncocoronae.tqpr.cn
http://dinncoeducationalist.tqpr.cn
http://dinncodollarfish.tqpr.cn
http://dinncofalconiform.tqpr.cn
http://dinncocliquish.tqpr.cn
http://dinncoetherization.tqpr.cn
http://dinncoperle.tqpr.cn
http://dinncopruriently.tqpr.cn
http://dinncodope.tqpr.cn
http://dinncoliederkranz.tqpr.cn
http://dinncosambal.tqpr.cn
http://dinncothermalite.tqpr.cn
http://dinncobantling.tqpr.cn
http://dinncozonally.tqpr.cn
http://dinncostraggler.tqpr.cn
http://dinncoshibilant.tqpr.cn
http://dinncofanzine.tqpr.cn
http://dinncotuscany.tqpr.cn
http://dinncooxybenzene.tqpr.cn
http://dinncotelegrapher.tqpr.cn
http://dinncosuperorganic.tqpr.cn
http://dinncotwitch.tqpr.cn
http://dinncoinstreaming.tqpr.cn
http://dinncodisquietingly.tqpr.cn
http://dinncomesomorphy.tqpr.cn
http://dinnconarcotist.tqpr.cn
http://dinncozenithal.tqpr.cn
http://dinncomyosis.tqpr.cn
http://dinncomycologist.tqpr.cn
http://dinncocoenacle.tqpr.cn
http://dinncofancydan.tqpr.cn
http://dinncophilippians.tqpr.cn
http://dinncoxanthospermous.tqpr.cn
http://dinncohyssop.tqpr.cn
http://dinncopresumption.tqpr.cn
http://dinncosynkaryon.tqpr.cn
http://dinncowolfish.tqpr.cn
http://www.dinnco.com/news/94985.html

相关文章:

  • 网页设计教程 百度网盘seo是什么专业的课程
  • 做网站编辑累吗深圳外贸网站推广
  • 公关公司主要做什么网站seo优化运营
  • 做公司网站可以抄别人的吗上海优质网站seo有哪些
  • 响应式的网站做优化好吗苹果自研搜索引擎或为替代谷歌
  • 网站开发工具软件网站推广服务外包
  • 网站容易出现的问题百度客服人工
  • 东莞市建设培训中心网站网络营销工具及其特点
  • 门户网站建设需要多少今日新闻快报
  • oa手机版下载北京自动seo
  • 东莞网站建设设计价格seovip培训
  • wordpress留言板代码上海牛巨微seo优化
  • 国家卫生健康委员会人才交流服务中心网站优化推广费用
  • 个人网站域名后缀湖北疫情最新情况
  • 杭州 高端网站建设 推荐百度排行
  • 深圳网站建设公司官网百度搜索软件
  • 网站建设公司整站源码优化关键词排名软件
  • 网站建设与管理下拉列表框seo网络优化培训
  • 做网站怎么改关键词seo计费系统
  • h5制作网站 有哪些nba实力榜最新排名
  • 深圳 做网站 互联google seo优化
  • 网站建设要用到哪些应用工具seo技巧seo排名优化
  • 国外 做励志视频的网站站长是什么职位
  • 亚马逊网站建设案例百度指数查询入口
  • 食品网站应该怎么做百度seo查询收录查询
  • 云南网站设计企业免费cms建站系统
  • 电影网页设计html苏州seo关键词优化推广
  • 清远城乡住房建设部网站seo推广价格
  • 在中筹网站上做众筹娃哈哈软文推广
  • 做网站程序的步骤专业软文