One solution for HTTP Error 500.21 – Internal Server Error

When I set IIS web server, I met multiple times about HTTP Error 500.21 – Internal Server Error.

I can not remember what the error screen exactly was, next time I must copy the screen.

I always forget how I got big help using a fast solution:

JUST RUN the command aspnet_regiis.exe –i

Very simple but you have to know it is not always working, but it is the one of you can choose to try.

Links about First Load Web App on IIS

If you used IIS server or Windows Hosting, you might know an annoying problem that if your website not be visited for while, the next visiting needs longer loading time, you have to wait up to over 60 seconds if your hosting is not good. This is because IIS has a feature for low traffic websites it recycles unused worker processes.

Continue reading “Links about First Load Web App on IIS”

Deploy an ASP.NET Project on IIS 6

One of our ASP.NET project was built based on .NET 4 and focused on IIS 7.x web server, but doesn’t matter, IIS 6 support .NET 4.0 well, so we should be able to deploy the project on IIS 6 server too.

Our system is Windows Server 2003 and IIS 6.

1: Load IIS Manager (Internet Information Services Manager)


2: Right mouse click “WebSites” and select “Web Site …” to create a new website:


3: Now we see the Web Site Creation Wizard, just follow it and click Next button:


4: Give a website description (Please know this description is actually the “website name” which will be shown under the Websites node in IIS Manager, just like the “Default Web Site”), click Next button:


5: Set an IP Address for your website, or just keep default settings if you are installing your website for a temporary testing, just like us.

Note: If you set (All Unassigned) IP addresses, then it will set your current computer’s IP address as the website’s IP address.

About TCP port, the default HTTP port is 80, you can set another port number such as 81 for your new website, but in real environment, you should always use 80 for your website. And, please know all your web projects normally should use 80 port, so you should create different Virtual Directories for your different websites or web applications.

About “Host header”, this is used for in case of you want to install multiple websites under a single URL or domain name such as

For our case, we keep all as default settings, and click Next button directly:


6: Now we enter a physical path on computer to be our new website home directory, we can directly click Browse button to choose one or create a new folder:


7: Now, choose Web site access permissions, normally, we should check on Read and Run scripts, if your web application includes some executable dll or CGI, you should check on Execute option also:


8: Now you can click Finish button to finish your steps:


9: Now you can see your new website showing under the Web Sites node, but its status is Stopped:


10:  Now you can right click the new website and try to Start it:


11: You will see the following error message:

IIS was unable to start the site. Another site may already be using the port you configured for this site. Please select a unused port for this site.


Actually this error for sure occurred because we set the 80 port to this new website, but actually the port 80 has already set to the “Default Web Site” which we have mentioned above.

So we either can set a new port number like 8080 to our new website, or change the existing Default Web Site’ port number to another number so that we can use 80 port.

12: Change existing default web site’s port number:

We change existing “Default Web Site” port number from 80 to 8080: Right click “Default Web Site” and choose Properties:


13: Change the port number from 80 to another number:


14: Now you should be able to start your new website, try to repeat step 10, you will see your new website now started:


15: We should also make sure which ASP.NET version is set currently, right click new website and select properties, and open ASP.NET tab, change the ASP.NET version to newest one which you have installed on current computer:


When you click OK, you will see the following message that tell you the web service should be restart, just click Yes button to restart the W3SVC service:


16: It is the time to copy your website content to the new website folder, copy your web application files and folders to the new website folder, which we created above in step 6, the folder name is CCWeb:


Actually before you copy your web application files, you should set right database connection string, and also corresponding Web URL if your web application used Web URL, such as WCF Service URL and Silverlight Service consume client application.

17: After you finished all above steps, now you just open your web browser, and input the address:  
     http://localhost/, you should see your website now.



Good luck, friends!

Install IIS 6 on Windows Server 2003

IIS 7.X web server versions are more and more popular, but there are still lots of real customers using old system, such as Windows Server 2003, they don’t want to upgrade the system now, especially those old servers are working for their existing system. So if you have ASP.NET projects which need an IIS web server, you have to install IIS 6.0 on Windows Server 2003.

Firstly, we should know Something about IIS.

Then let us install IIS 6 on Windows Server 2003.

There are 2 methods (Actually due to Microsoft, there are at least 3 methods) to install IIS 6 on Windows Server 2003:

Method 1: Using Manage Your Server

1: From the Start menu, select “Manage Your Server”


2. In “Manage Your Server” Windows, just under “Managing Your Server Roles”, click “Add or remove a role”.


3. In “Preliminary steps” window, Click Next:


4: Now system is checking your network settings:


4. After a short while, you will see the following screen, Because we are installing an IIS web server, so we should select “Application server (IIS, ASP.NET)”:


5. On the Application Server Options window, Check on the appropriate check boxes, and then click Next (we checked on both of them).


6. You will see the summary window similar like following, click Next:


7. Continue to complete the wizard, and then click Finish.


Method 2: Using Control Panel

1. From the Start menu, click Control Panel, choose “Add or Remove Programs”:


2. Click “Add/Remove Windows Components” on the left side:


3. In the Components list box, check on “Application Server”


4. Here you can click the “Details…” button to see more details of Application Server, we can see the IIS (Internet Information Services) and ASP.NET are just in the subcomponents list, which are what we just need.

Check on IIS, ASP.NET and all options which you want. 


5: And click Next button to continue to IIS 6 installation.

Above are the 2 methods which we often to choose. for more methods, please read Microsoft official Install IIS 6.

Something About IIS

IIS is the Web Server software from Microsoft. Normally IIS is a part of Windows OS system, it means you do not need to purchase an IIS separately.

The  IIS version and Windows system version matches (Due to the record from Wikipedia):

IIS 1.0 was a free add-on for Windows NT 3.51.
IIS 2.0 was included with Windows NT 4.0.
IIS 3.0 was included with Windows NT 4 SP3
IIS 4.0 was released as "Option Pack" for Windows NT 4.0.
IIS 5.0 shipped with Windows 2000
IIS 5.1 was shipped with Windows XP Pro
IIS 6.0 was included with Windows Server 2003 and Windows XP Pro x64 Edition
IIS 7.0 was a complete redesign and rewrite of IIS, and was shipped with Windows Vista and Windows Server 2008.
IIS 7.5 included in Windows 7 and Windows Server 2008 R2.
IIS 8.0 is only available in Windows Server 2012 and Windows 8.

And, we must know the IIS version is for corresponding Windows OS version, for example: IIS 7 can not installed on Windows server 2003; and, IIS 6 can not installed and run on Widows server 2008 and Windows 7; 

Hate installations? Use Lightweight IIS and SQL Server

When you build an ASP.NET application, you might fee some boring works which you have to install a SQL Server database , no matter you can install SQL Server Express version, but you still have to install it. and also, if you want to try your application without using Visual Studio, you have to install IIS or set the existing IIS in your Windows system.

Now you will no more hate the above 2 works: Microsoft has provided you 2 new great products:

1: IIS Developer Express (This was called by Microsoft’s Scott Gu before, now the formal name is IIS Express, or include version number such as IIS 7.5 Express):
 A lightweight web server, a lightweight IIS, even it is compatible with IIS 7.5

2: SQL Server Compact Edition:
 A lightweight file-based SQL Server database.

About IIS Express (From Scott Gu’s blog):

    It’s lightweight and easy to install (less than 10Mb download and a super quick install)
    It does not require an administrator account to run/debug applications from Visual Studio
    It enables a full web-server feature set – including SSL, URL Rewrite, Media Support, and all other IIS 7.x modules
    It supports and enables the same extensibility model and web.config file settings that IIS 7.x support
    It can be installed side-by-side with the full IIS web server as well as the ASP.NET Development Server (they do not conflict at all)
    It works on Windows XP and higher operating systems – giving you a full IIS 7.x developer feature-set on all OS platforms

Actually, IIS Express has been released. You have 2 ways to get it:

1: If you use WebMatrix, IIS Express has been included with WebMatrix, you just need to install WebMatrix only;
2: If you want to install IIS Express only;
All details info, please read Microsoft Official site here about IIS Express

About SQL Server Compact Edition (SQL Server CE – This was Scott Gu’s called before, now the version called SQL Server Compact 3.x)

Below content copied from MS Official site:

SQL Server Compact is a free SQL Server embedded database ideal for building standalone and occasionally connected applications for mobile devices, desktops, and Web clients.

Top Features:

    Free to use and distribute
    Supports desktops and mobile devices
    Small footprint for easy deployment
    Fully embeddable architecture
    No administration required
    Single file, code-free database format
    Support for ClickOnce, XCopy, MSI, CAB, and non-admin embedded installation options
    Supports all Microsoft Windows embedded, mobile, desktop, and server operating systems
    Supports a rich subset of Transact-SQL syntax and SQL Server data types
    Microsoft Visual Studio 2008 integration
    Supports ADO.NET, LINQ to SQL, LINQ to Entities, and the ADO.NET Entity Framework
    Supports multiple concurrent local connections

All detail information please read MS Official site here about SQL Server Compact

BTW: DO not forget to visit Scott Gu’s blog, it is always helpful very much !

Setting IIS 7 for .NET 4.0 in Windows 7 (3)

There are 3 parts about these steps:
I: Setting IIS 7 for .NET 4.0 in Windows 7 (1)
II: Setting IIS 7 for .NET 4.0 in Windows 7 (2)
III: Setting IIS 7 for .NET 4.0 in Windows 7 (3)

Now let us add virtual directory for new web site:

1: You can add multiple web sites,  or you can add multiple web sites under same one “web site” in IIS which using Add virtual directory

    Aach virtual directory can be used for a separate web site, this is just like the old IIS 5.1 which dose not provides Add Website feature.

2:  Give alias name and physical path for virtual directory:

3: Add application pool for virtual directory:

4: Covert the virtual directory to Application

select the virtual directory in left side and right mouse click, choose “Convert to Application

5: Set all needed fields:

6: 0x800704ec error

Try the new virtual directory (new application website)
 you might see the following error message:

 HTTP Error 404.2 – Not Found
The page you are requesting cannot be served because of the ISAPI and CGI Restriction list settings on the Web server.
Detailed Error Information
Module    IsapiModule
Notification    ExecuteRequestHandler
Handler    PageHandlerFactory-ISAPI-4.0_32bit
Error Code    0x800704ec
Requested URL    http://localhost:80/Website00/default.aspx
Physical Path    C:\Tony\IIS\TestSites\Website00\default.aspx

you should change the setting for ISAPI and CGI Restriction:

7: Change the “Not Allowed ” to “Allowed” for all .NET 4.0 versions:

8: then go to check your new website, it works now !

Setting IIS 7 for .NET 4.0 in Windows 7 (2)

There are 3 parts about these steps:
I: Setting IIS 7 for .NET 4.0 in Windows 7 (1)
II: Setting IIS 7 for .NET 4.0 in Windows 7 (2)
III: Setting IIS 7 for .NET 4.0 in Windows 7 (3)

After IIS installed and some related setting. now it is the time to add a website on IIS 7:

1: Select Sites on left side, we are going to add a new web site other than using the existing Default Web Site.

2: In “Add Web Site” interface, fill the Site Name, give a Physical path which you want to set to a website root folder in the computer:

    make sure the Start website intermediately checked on, then click OK.

3: Click Yes when you see the following screen, unless otherwise you know the port 80 was occupied by other web server or other applications:

4: Modify the setting for new web site:

After you added a new website, you might want to change some settings about it such as change the Physical path for web root directory, then you select the new web site and right click mouse, choose Manage Web site, the select Advanced Settings…

5: Change Physical Path: