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?
IIS has its own ASP.NET Process Engine to handle the ASP.NET request. So, when a request comes from client to server, IIS takes that request and process it and send the response back to clients. Hope, till now it's clear to you that what is the Web server and IIS is and what is the use of them.
The answer is, no you don't.
Yes, we can run an Asp.Net web application without web.
It all depends on the version of Internet Information Services (IIS) and the request processing mode for your application. Here's a summary of the different versions of IIS: IIS 7.0 (integrated mode) - No special configuration necessary to use ASP.NET Routing.
An IIS or ASP.NET hang can cause your website to have slow page loads, timeouts, or 503 Service Unavailable errors. Hangs can be caused by blocked ASP.NET threads, bad configuration, or request queueing.
IIS can also be used as the web server software in the development environment, although this entails installing IIS and properly configuring it. The ASP.NET Development Server is an alternative web server option for the development environment; it ships with and is integrated into Visual Studio.
For example FTP publishing, application request routing, media services and URL rewriting are all new features introduced in IIS 7.5 via extensions. And IIS offers strong support for the Microsoft products .NET (framework) and ASPX (scripting), so if your website relies heavily on these, IIS is a clear frontrunner as a choice of web server.
The strange thing though, was that for subsequent use, even for other users, it went blazing fast. It took some research, but we stumbled upon the reason. IIS operates with what they call “application pools”. Application pools allow you to isolate your applications from one another, even though they are running on the same server.
Configure the application pool used by the web application to enable 32-bit applications:
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?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With