Solutions to Problems Setting up Virtual Directory in IIS 7

Hello Friends,

[Note: I am running Windows7 , Visual Studio 2010 and IIS 7 on my machine].

In order to setup virtual directory on my machine and letting IIS server serve my pages(with extensions .asp, .aspx), I came across certain issues that I will address in the following document.

Running IIS

Windows XP, Vista or Windows 7 do not have IIS installed by default. Inorder to install it, go to Control Panel à Programs and Features -> Turn windows features on or off. In the dialog box find Internet Information Services and check on the checkboxes under it as shown below.

Note: Make sure to check ASP under Application Development Features. Also, make sure to check Static Content(this lets iis serve CSS, IMG and JS files) under Common HTTP Features.

To check if IIS is running. Go to your browser and type http://localhost. It should give you a page with IIS 7 image on it.

Hit OK. This would take some time to install all the features.

Opening IIS Manager
Shortcut: Start -> Run … type inetmgr
Control Panel  System Security  Administrative Tools  IIS Manager.
[After this follow the steps to create a virtual directory. Find the steps on Lecture 2 page].
Note: Make sure to build/compile your project solution before you directly browse your pages from iis. Otherwise the browser throws an error for not being able to find it in Global assembly cache.
Issues with IIS Windows 7
1. On browsing .aspx page , browser gives error HTTP 500.19 and error message for not having sufficient privileges to serve the page.
Solution: Giving access permissions to IIS_IUSRS Group.
1. Right Click on your virtual directory application and click on Edit Permissions.
2. Go to Sharing Tab and click Share.

3.On clicking share will open a dialog box as shown. Write IIS_IUSRS in the textbox and hit Add.

4.Change the permission of IIS_IUSRS group from Read to Read/Write for IIS_IUSRS.

  1. Hit Share for changes to save. Click Done.

Note: You should now be able to open your .asp and .aspx files in your browser.

  1. 1. Pages viewed from Virtual Directory not rendering CSS/ Javascript/Images.

Solution: Firstly make sure that while installing your IIS you had clicked on Static Content option under Common HTTP Features Section.

Sometimes even after that, the browser doesn’t render any css or javascript files.

Problem is with IIS 7 that it needs to be told explicitly for mapping the .css, .image files and javascript files to be run by IIS 7.

To do so, follow the steps:

1. In your IIS Manger, click on your virtual directory and switch to features view (from down bottom button).
2. Double click on Handler Mappings. It opens a dialog page showing all the existing mappings. On right it gives certain links to add managed handler
3. Click on Add Managed Handler. In the dialog, add a mapping for .css files as shown1. Hit OK to save
2. Similarly, do a Add Managed Handler for other extensions like .js,.png,.jpg and gif.
3. Now when you browse your pages from your IIS, they should render css, display images and javascript should work.


4 responses to this post.

  1. Posted by Ruben on August 10, 2010 at 8:53 pm

    Been strugling with .js not served by IIS. Thanks a lot for the solution.


  2. I do consider all of the ideas you’ve offered for your post. They are really convincing and can certainly work. Still, the posts are too brief for starters. May just you please prolong them a bit from next time? Thanks for the post.


  3. I not found System.Web.StaticFileHandle


  4. Posted by sebastian on July 23, 2013 at 10:39 am

    Thanks for this tip.
    “Problem is with IIS 7 that it needs to be told explicitly” – sentence which saved my lost hair.

    It’s “System.Web.StaticFileHandler”
    not “System.Web.StaticFileHandle”


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: