为什么IIS比ASP.NET开发服务器慢? [英] Why is IIS slower than ASP.NET Development Server?

查看:454
本文介绍了为什么IIS比ASP.NET开发服务器慢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ASPX网页,做一些复杂的操作和数据库调用。当我通过运行ASP.NET开发服务器(卡西尼)查看网页时,约需要的 200ms的

随后,的没有任何code变更和配置更改的,我的网站部署到我的本地机器IIS 7,并再次查看相同的网页。它需要的 2.0秒的,这就是慢10倍

我想IIS应该比(或至少一样快)快卡西尼。

要进一步调查,我创建了一个新的页面,test1.aspx,其中包含只是一个空的for循环,对在Page_Load 9000万次运行。在卡西尼号,它需要200ms左右。在IIS中,它需要(慢50%),300毫秒。

可能是什么,使IIS之所以比卡西尼慢?或者,也许一个更好的问题,我怎么能做出IIS运行速度至少为卡西尼?


解决方案

快速,简短的回答:

配置使用的Web应用程序,以使32位应用程序的应用程序池:

详细演练:

我使用了一些性能分析工具(有些是免费)比较表演和找出瓶颈。免费 EQATEC探查是不够好,让我比较来自卡西尼运行和IIS生成的两份报告,找出造成问题的方法。然而,这种方法包含了太多的线条和我无法得到精确的线路出了故障。

然后展鹏蚂蚁就派上用场了。通过与线路电平详细分析的方法,我发现,这是正则表达式的运行速度非常缓慢。

继续搜索使我的答案在这里: RegEx.Match在IIS慢得多相比,开发服务器(卡西尼)。我使用Windows 7 64位与IIS 7.设置启用32位应用程序,以真正解决问题。


此外,在运行IIS的32位或64位略有相关阅读:


  

用于诸如数据库时,64位服务器是更有效
  SQL Server或其他数据管理服务器(比方说,一个企业
  如Exchange电子邮件服务器),比处理服务器,如 IIS
  或工作进程它管理。


  
  

这将需要对每个查询的64位指针,这将使
  一切都慢一点。


来源:什么是在64位操作系统上运行IIS作为32位VS 64位的利弊

I have an ASPX webpage that does some complex operations and database calls. When I view the webpage by running ASP.NET Development Server (Cassini), it takes about 200ms.

Then, without any code changes and configuration changes, I deploy the website to my local machine IIS 7 and view the same web page again. It takes 2.0sec, which is 10 times slower.

I thought IIS should be faster than (or at least as fast as) Cassini.

To investigate further, I created a new page, test1.aspx, which contains nothing but an empty for-loop that runs for 90 million times in the Page_Load. In Cassini, it takes about 200ms. In IIS, it takes 300ms (50% slower).

What could be the reason that makes IIS slower than Cassini? Or, perhaps an even better question, how can I make IIS run at least as fast as Cassini?

解决方案

Fast and short answer:

Configure the application pool used by the web application to enable 32-bit applications:

Detailed walkthrough:

I used some performance profiling tools (some are free) to compare the performances and to find out the bottlenecks. The free EQATEC Profiler is good enough to allow me compare two reports generated from running Cassini and IIS and identify the method causing the problem. However, the method contains too many lines and I was unable to pinpoint the exact line causing the problem.

Then Redgate ANTS comes in handy. By profiling the method with line-level detail, I found that it was RegEx running very slowly.

Further searching leads me to the answer here: RegEx.Match is much slower in IIS compared to Development Server (Cassini). I am using Windows 7 64bit with IIS 7. Setting the "Enable 32-bit applications" to True solves the problem.


Also, a slightly related reading on running IIS as 32bit or 64bit:

64-bit servers are much more effective when used for databases like SQL Server, or other data management servers (let's say, an enterprise email server like Exchange), than for processing servers, such as IIS or the worker processes it manages.

It will require 64-bit pointers for every lookup, which will make everything a little slower.

Source: What are the pros and cons of running IIS as 32bit vs 64bit on a 64bit OS?

这篇关于为什么IIS比ASP.NET开发服务器慢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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