asp.net core 2.0 app.Run两次通话? [英] asp.net core 2.0 app.Run call twice?

查看:168
本文介绍了asp.net core 2.0 app.Run两次通话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在asp.net core 2.0中创建新项目为空时,并编写一些代码.和调试,但我看到app.Run在浏览器中刷新一次运行两次,但我不明白为什么?来人帮帮我 在program.cs中查看此代码 program.cs中的代码

when i create new project empty in asp.net core 2.0, and write some code. And debug, but i see app.Run run twice once when i refresh in browser, but i don't understand why? somebody help me see this code in program.cs code in program.cs

,并在startup.cs中查看此代码 startup.cs中的代码

and see this code in startup.cs code in startup.cs

我不明白我总是偶数(0,2,4,6,8 .... n),但是我调试了代码,我可以老了(1,3,5,7 ..... )和app.Run调用两次.为什么?帮助我理解它.

i don't understand i is always even(0,2,4,6,8....n), but i debug code, i can old (1,3,5,7.....), and app.Run call to twice. why? help me understand it.

推荐答案

如果您检查第二个请求的请求URL,我相信您会发现它适用于

If you check the request URL for the second request, I am sure you will find it is for http://yoururl/favicon.ico.

浏览器始终要求收藏夹",以便他们可以在选项卡上显示它.这是浏览器的功能,您的应用程序没有任何问题.

Browsers request for the "favicon" always so they can show it on the tab. This is a feature of browsers, nothing is wrong in your app.

这篇关于asp.net core 2.0 app.Run两次通话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆