Image Resizer - Configuring IIS

This is regarding a deprecated version. Visit the updated version of this page

Using IIS7 Integrated mode or the Visual Studio web server? You can skip this step. You don't need to do this if you are using the .jpg.ashx syntax.

Remember to use the path for YOUR version of asp.net in both IIS and web.config. The safest way is to copy it from an existing .aspx mapping.

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.
    <configuration>
    ...
  <system.webserver>
    <handlers>
      <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">
    </add></handlers>
  </system.webserver>
    ...
</configuration>

IIS7 Classic 64-bit

 <configuration>
    ...
  <system.webserver>
    <handlers>
      <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″/">
    </add></handlers>
  </system.webserver>
    ...
</configuration>

Published on

About Nathanael

Nathanael Jones is a software engineer, father, consultant, and computer linguist with unreasonably high expectations of inanimate objects. He refines .NET, ruby, and javascript libraries full-time at Imazen, but can often be found on stack overflow or participating in W3C community groups.

ImageResizer

If you develop websites, and those websites have images, ImageResizer can make your life much eaiser. Find out more at imageresizing.net.

Imazen

I run Imazen, a tiny software company that specializes in web-based image processing and other difficult engineering problems. I spend most of my time writing image-processing code in C#, web apps in Ruby, and documentation in Markdown. Check out some of my current projects.

More articles