Image Resizer – Configuring IIS

Posted on June 6, 2008

Using IIS7 Integrated mode or the Visual Studio web server? You can skip this step.

Installing on IIS 5 & IIS 6

For the module to operate properly, we must configure IIS to pass all requests to the ASP.NET runtime. By default IIS serves these files itself.

1) Open IIS, right-click on your web site, and choose properties.

2) Click the “Home Directory” tab, then “Configuration”

3) For a wildcard mapping on IIS 5, add extension “.*”. For IIS 6, choose “Insert” and add the aspnet_isapi.dll executable %windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll inside the wildcard applications maps area. For both IIS 5 and 6, make sure “Script Engine” is checked. “Verify file exists” will need to be unchecked if you plan to do any URL rewriting, but should be left checked if you are using the default documents feature of IIS. (URL rewriting with the UrlRewriting.Net library provides much more power than IIS default documents. I highly recommend it).

Note: For 64-bit installs, use “%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll”. The most reliable way to determine the path of aspnet_isapi.dll is to copy it from the .aspx mapping. You have to use the right-click menus – the keyboard shortcuts don’t work.

Installing on IIS 7 classic mode

IIS 7 mode mappings are done in web.config. Do not add these if you are using IIS 7 Integrated mode (the default). You may get Server Unavailable on your image requests. None of the steps on this page are needed on IIS7 Integrated (default), and may actually cause problems.


    ...
  
    
      
    
  
    ...

IIS7 Classic 64-bit


    ...
  
    
      
    
  
    ...

7 Responses to “Image Resizer – Configuring IIS”

  1. Johnny
    Nov 13, 2009
    Reply

    Hi Nethanael,

    Was just setting up the component on IIS7 in clasic mode and copied the above web.config line which errored due to the capitalization of some of the paramter names i.e scriptprocessor should be scriptProcessor.

    The whole line should be:


  2. Simon
    Nov 20, 2009
    Reply

    We had everything working on our 32bit II7 install using

    add name=”ASPNET” path=”*” verb=”*” modules=”IsapiModule” scriptProcessor=”%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll” resourceType=”Unspecified” requireAccess=”None” preCondition=”classicMode,runtimeVersionv2.0,bitness32″

    But when we deployed onto our 64 bit IIS7 sever we needed to change the settings to

    add name=”ASPNET” path=”*” verb=”*” modules=”IsapiModule” scriptProcessor=”%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll” resourceType=”Unspecified” requireAccess=”None” preCondition=”classicMode,runtimeVersionv2.0,bitness64″

    This is not realy my area, but the changes seem to work….


    • Nathanael Jones
      Nov 20, 2009
      Reply

      Thanks! I’ve corrected the documention to include 64-bit… Somehow I completely overlooked that situation when writing this article.


  3. Cult
    Feb 19, 2010
    Reply

    I'm using webhost4life, which I think is running IIS6. They have a control panel option to add a script map for *.jpg to go to ASP.NET, but when I do that all requests to jpgs on the site forward to the login screen. Only the /admin path is secured through. I can actually see the jpgs appearing in the imagecache, so I know the module is running and working fine, it is just that ASP.NET thinks the request should be authenticated for some reason. Has anyone seen this happen before? Do you know what setting might cause that to occur?


    • Individual mappings seem to be very problematic… If wildcard mapping isn't an option, I'd suggest the .ashx/.axd alternative syntax…

      Every version of IIS seems to be buggy regarding individual mappings…

      There are a few things you could try… make sure NTFS permissions on both the image and the imagecache folder are set properly for both the IIS account AND the ASP.NET account. Verify the mapping is a script engine mapping… Check your URL authorization in web.config for bugs, and verify Anonoymous authentication works properly.


  4. Your product works fine on my dev platform (.Net3.0) but I can't make it work in my production environment (IIS6 and .Net 2.0). The Web Config file seems to be well configured, but I always have the “Page not found” when I’m trying URL such ashttp://icilocal.ca/Images/cies/Annonces/250043.jp... . Any idea?


    • Open the ashx handler mapping in iis6 and uncheck 'verify file exists’.



Leave a Reply