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

请将uploads里面的所有文件和文件夹上传到你的网站根目录中国建设银行网官方网站

请将uploads里面的所有文件和文件夹上传到你的网站根目录,中国建设银行网官方网站,建设摩托车官网中国,建手机wap网站大概多少钱web应用程序的性能相信是大家普遍关心的一个问题#xff0c;也相信大家有很多工具可用来分析应用程序的性能并能够找到其中的瓶颈#xff0c;MiniProfiler 就是这个领域中的一款产品#xff0c;它是一款简单的#xff0c;功能强大的web应用分析工具#xff0c;MiniProfile… web应用程序的性能相信是大家普遍关心的一个问题也相信大家有很多工具可用来分析应用程序的性能并能够找到其中的瓶颈MiniProfiler 就是这个领域中的一款产品它是一款简单的功能强大的web应用分析工具MiniProfiler 可用来帮助我们找到 慢查询, 慢响应 等问题。MiniProfiler 可用在 Asp.Net 和 ASP.Net Core 中这篇文章将会讨论如何使用 MiniProfiler并通过它找到应用程序的性能问题。安装 MiniProfiler 要想使用 MiniProfiler需要通过 nuget 引用 MiniProfiler.AspNetCore.Mvc 包可以通过 Visual Studio 2019 的 NuGet package manager 可视化界面安装 或者 通过 NuGet package manager 命令行工具输入以下命令 dotnet add package MiniProfiler.AspNetCore.Mvc安装好之后接下来就要将 MiniProfiler 注入到 ServiceCollection 容器中如下代码所示// This method gets called by the runtime. Use this method to add services to the container.public void ConfigureServices(IServiceCollection services){services.AddControllersWithViews();services.AddMiniProfiler(options  options.RouteBasePath  /profiler);}注入好之后接下来就需要使用 UseMiniProfiler 扩展方法将其注入到 Request Pipeline 管道中如下代码所示public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory){app.UseMiniProfiler();app.UseEndpoints(endpoints {endpoints.MapControllerRoute(name: default,pattern: {controllerHome}/{actionIndex}/{id?});});}然后在 _Layout.cshtml 页面中增加如下两行命令。 using StackExchange.Profiling addTagHelper *, MiniProfiler.AspNetCore.Mvc最后需要在 WebPage 中指定 MiniProfiler 分析窗口应该显示的位置那如何做呢在 body 标签内使用 mini-profiler 标记如下代码所示 mini-profiler positionRenderPosition.Right max-traces5 /在 ASP.Net Core MVC 中使用 MiniProfiler MiniProfiler 会提供 页面加载时间 和 数据库查询性能指标接下来把程序跑起来,你会看到如下的性能指标图。有些朋友可能就要问了大体时间我是知道了那如果我只想获取某一指定代码块的执行时间呢当然也是可以的下面的代码展示了如何去实现。public class HomeController : Controller{ILoggerHomeController logger;public HomeController(ILoggerHomeController logger){this.logger  logger;}public IActionResult Index(){var miniProfiler  MiniProfiler.Current;ListAuthor authors  new ListAuthor();miniProfiler.RenderIncludes(this.HttpContext);using (miniProfiler.Step(Get Authors)){authors.Add(new Author() { Id  1, FirstName  Joydip, LastName  Kanjilal, Address  Hyderabad, India });authors.Add(new Author() { Id  2, FirstName  Stephen, LastName  Smith, Address  NY, USA });authors.Add(new Author() { Id  3, FirstName  Anand, LastName  Narayanan, Address  Chennai, India });authors.Add(new Author() { Id  4, FirstName  Steve, LastName  Jones, Address  London, UK });}return View(authors);}}public class Author{public int Id { get; set; }public string FirstName { get; set; }public string LastName { get; set; }public string Address { get; set; }}从上面的代码中可以看到我用 using (miniProfiler.Step(Get Authors)) 做了语句块标记理论上 mini-profile 窗口上应该有类似 Get Authors 指标栏接下来把程序跑起来一起来看看效果。除了顺向操作你也可以指定让某些代码块不要显示在 mini-profile 中需要做的是调用 Ignore() 即可如下代码所示 using (MiniProfiler.Current.Ignore()) {// Write code here that you dont// want MiniProfiler to profile }使用 MiniProfile 分析 ADO.NET 查询 除了做一些常规的页面分析还可以直接对 ADO.NET 查询性能进行分析这就????????了要这么做的话需要使用 ProfileDbConnection 和 ProfileDbCommand 即可如下代码所示public IActionResult Index(){using (SqlConnection connection  new SqlConnection(Data Source.; Initial CatalogPYZ_L; Trusted_ConnectionYes)){using (ProfiledDbConnection profiledDbConnection  new ProfiledDbConnection(connection, MiniProfiler.Current)){if (profiledDbConnection.State ! System.Data.ConnectionState.Open){profiledDbConnection.Open();}using (SqlCommand command  new SqlCommand(Select * From Clothes, connection)){using (ProfiledDbCommand profiledDbCommand  new ProfiledDbCommand(command, connection, MiniProfiler.Current)){var data  profiledDbCommand.ExecuteReader();//Write code here to populate the list of Authors}}}}return View();}从上图可以看到确实对 ADO.NET 查询有着清晰的分析相信在帮助大家分析问题时很有帮助。MiniProfiler 是一个可应用于 .NET, Ruby, Go 和 Node.js 的性能分析工具你可以使用 MiniProfiler 去分析 DapperLinq2SQLEntity Framework 所使用的sql的查询性能此外 MimiProfile 之所以 Mini意味着它介入到你的应用程序中所带来的性能开销微乎其微所以大家可放心的丢到生产上去吧译文链接https://www.infoworld.com/article/3330560/how-to-use-miniprofiler-in-aspnet-core.html
http://www.pierceye.com/news/976141/

相关文章:

  • 网站成品超市学室内设计去哪好
  • 网站备案一个主体无锡建设银行网站
  • delphi xe10网站开发台州做网站多少钱
  • 怎样设计卖奖的网站做电影网站哪个服务器好
  • 找外包公司做网站的好处和坏处wordpress 访问量大
  • 淄博 网站设计越秀公司网站建设
  • 网站该如何做本地网站搭建软件
  • 如何做汽车团购网站学做馒头面包哪个网站好
  • 中国科技成就总结莱芜网站优化排名公司
  • 中国建设银行网站企业网银收费北京网站建设小程序开发
  • 成交型网站倡导公司网络营销课程总结1000字
  • 网站建设注册前端开发培训机构推荐
  • 遵义网站推广中国房地产app下载安装最新版
  • c语言网站建设禅城网站开发
  • 宁波品牌网站制作哪家好太平阳电脑网网站模板
  • seo网站外链工具看设计比较好的网站
  • 济南道驰网站建设有限公司怎么样某网站网站的设计与实现
  • 服装印花图案设计网站设计一个网站要多久
  • ai怎么做自己的网站getpage wordpress使用详解
  • 龙岩做网站推广龙岗网站 建设深圳信科
  • 沈阳网站建设 网络服务广告公司首页
  • 旅游网站建设导航栏中国哪里正在大开发大建设
  • 哪能建设网站建设网站需要哪些流程图
  • 网站YYQQ建设o2o型网站
  • 给客户做网站 赚钱吗赣州省住房和城乡建设厅网站
  • 营销优化型网站怎么做手机app网页制作
  • 上海网站建设服wordpress友情链接排序
  • 沈阳市和平区网站建设编程课适合多大孩子学
  • 东阳网站优化懒人图库
  • 马关县网站建设专注营销型网站建设