asp.net-mvc 使用 IIS Express 启动缓慢
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23880900/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Slow startup with IIS Express
提问by Jakobbbb
I have a problem with my MVC application and startup.
我的 MVC 应用程序和启动有问题。
Every time I make a change and one the app its take a long time to start up.
每次我进行更改时,应用程序都需要很长时间才能启动。
I have about 100 lines with ''iisexpress.exe' (CLR v4.0.30319:'
我有大约 100 行“iisexpress.exe”(CLR v4.0.30319:)
Do I have to start iisexpress every time I run my application?
每次运行应用程序时都必须启动 iisexpress 吗?
回答by Korayem
I found significant improvement after disabling logging.
禁用日志记录后,我发现了重大改进。
Locate the IIS configfor your project or machine, typically found in:
找到您的项目或机器的IIS 配置,通常位于:
%userprofile%\documents\iisexpress\config\applicationhost.config.\.vs\config\applicationhost.config
%userprofile%\documents\iisexpress\config\applicationhost.config.\.vs\config\applicationhost.config
And comment out or delete the following two nodes (found somewhere in the document)
并注释掉或删除以下两个节点(在文档某处找到)
<add name="HttpLoggingModule" image="%IIS_BIN%\loghttp.dll" />
<add name="HttpLoggingModule" lockItem="true" />
回答by Martin Belcher - AtWrk
I had this same problem, tested with VS2010 and VS2015. Symptom: VS was quick, compiled, loaded symbols and opened browser within a second but then browser just hung for 5 to 20 minutes. My projects are huge but my laptop is 16GB RAM, i7 and SSD so definitely not a size problem. I tried all the answers on this question and also here Visual Studio debugging/loading very slow.
我有同样的问题,用 VS2010 和 VS2015 测试过。症状:VS 很快,编译、加载符号并在一秒钟内打开浏览器,但浏览器只挂了 5 到 20 分钟。我的项目很大,但我的笔记本电脑是 16GB RAM、i7 和 SSD,所以绝对不是尺寸问题。我尝试了关于这个问题的所有答案,也在这里Visual Studio 调试/加载非常慢。
In the end I found the solution here https://social.msdn.microsoft.com/Forums/en-US/394f3100-bac2-4b1c-8f8c-731226b905d4/painfully-slow-starting-a-web-application-in-visual-studio?forum=visualstudiogeneral
Exclude the directory "C:\Windows\Microsoft.NET\Framework" from antivirusscanning
从防病毒扫描中排除目录“ C:\Windows\Microsoft.NET\Framework”
Hopefully this will save someone else so much wasted time :)
希望这会为其他人节省很多浪费的时间:)
回答by Andras
I had the same problem with IIS Express 10, Visual Studio 2015 Update 3 on Windows 10. I did a few tests and with different settings and browsers (Chrome 54, Edge 38, Opera 41). The browser doesn't really matter, but I found three things which significantly changed my original 15 seconds load time:
我在 Windows 10 上的 IIS Express 10、Visual Studio 2015 Update 3 上遇到了同样的问题。我做了一些测试,并使用了不同的设置和浏览器(Chrome 54、Edge 38、Opera 41)。浏览器并不重要,但我发现三件事显着改变了我原来的 15 秒加载时间:
- Switched Windows Defender 4.10 off (changed from 15 to 12 seconds)
- Turned Edit and Continue feature off (changed from 12 to 6 seconds)
- Switched Windows Defender 4.10 back (changed from 6 to 8 seconds)
- Tried to run the application without debugging (changed from 8 to 2 seconds)
- 关闭 Windows Defender 4.10(从 15 秒更改为 12 秒)
- 关闭编辑并继续功能(从 12 秒更改为 6 秒)
- 切换回 Windows Defender 4.10(从 6 秒更改为 8 秒)
- 尝试在不调试的情况下运行应用程序(从 8 秒更改为 2 秒)
So if you are willing to give up Edit and Continue, or even debugging then you can speed up the process.
因此,如果您愿意放弃“编辑并继续”,甚至是调试,那么您可以加快该过程。
Edit and Continue can be turned off in Visual Studio/Tools/Options/Debugging/General/Enable Edit and Continue.
可以在 Visual Studio/Tools/Options/Debugging/General/Enable Edit and Continue 中关闭 Edit and Continue。
You can start your project without debugging with Ctrl+F5.
您无需使用 Ctrl+F5 调试即可启动您的项目。
I would notrecommend to turn off your Windows Defender, but you can play around with its exclude directory function, you might win a few seconds there as well.
我不建议关闭你的 Windows Defender,但你可以使用它的排除目录功能,你也可以在那里赢得几秒钟。
回答by Thiru
I had similar problem. When I run the process monitor I found that my fusion log is enabled after disabling fusion log IIS Express loaded the sites without much delay.
我有类似的问题。当我运行进程监视器时,我发现我的融合日志在禁用融合日志后启用了 IIS Express 加载站点没有太多延迟。
回答by The Pax Bisonica
IIS Express should continue to run in the background while you change and compile your code. You can then go to Debug -> Attach Process and find the iisexpress.exe process and attach to it. The problem with hitting F5 every time is that VS tears down the process and restarts it which takes time.
当您更改和编译代码时,IIS Express 应该继续在后台运行。然后,您可以转到 Debug -> Attach Process 并找到 iisexpress.exe 进程并附加到它。每次按 F5 的问题是 VS 会破坏进程并重新启动它,这需要时间。
回答by marsze
It may help to check the following Debug options:
检查以下调试选项可能会有所帮助:
Tools > Options > Debugging > General
工具 > 选项 > 调试 > 常规
- Enable
"Enable Just My Code" - Disable
"Enable .NET Framework Source Stepping" - Disable
"Source Server Support" - Disable
"Source Link Support" - Disable
"Use Managed Compatibility Mode" - Disable
"Enable Edit And Continue"
- 使能够
"Enable Just My Code" - 禁用
"Enable .NET Framework Source Stepping" - 禁用
"Source Server Support" - 禁用
"Source Link Support" - 禁用
"Use Managed Compatibility Mode" - 禁用
"Enable Edit And Continue"
Tools > Options > Debugging > Symbols
工具 > 选项 > 调试 > 符号
- Disable all Symbol file locations
- Set Symbol cache directory
- Select
"Load only specified modules" - Click
"Specify included modules"and disable all
- 禁用所有符号文件位置
- 设置符号缓存目录
- 选择
"Load only specified modules" - 单击
"Specify included modules"并禁用所有
回答by Guru Josh
I was experiencing slow startup of my ASP.NET MVC application using Visual Studio 2017 and IIS Express. I tried almost every suggestion in this thread without any noticeable application startup speed. The one thing that worked was launching the application without debugging using Ctrl+F5. This improved the launch time from 10-20 seconds to just a few seconds. If the browser window is kept open, coding edits can be tested by refreshing the browser. Editing models or controllers require the project to be (re)built whereas changes to views are reflected without a project (re)build.
我在使用 Visual Studio 2017 和 IIS Express 时遇到了我的 ASP.NET MVC 应用程序启动缓慢的问题。我尝试了该线程中的几乎所有建议,但没有任何明显的应用程序启动速度。有效的一件事是在不使用 Ctrl+F5 调试的情况下启动应用程序。这将发射时间从 10-20 秒缩短到几秒钟。如果浏览器窗口保持打开状态,则可以通过刷新浏览器来测试编码编辑。编辑模型或控制器需要(重新)构建项目,而无需项目(重新)构建即可反映对视图的更改。

