Skip to content
This repository

Here are some steps to walk through and some items to consider when it appears as though RequestReduce is just not running:

  • Did you install via Nuget?

    You can eliminate alot of room for error by installing RequestReduce via nuget. RequestReduce will make sure that its assembly is referenced and will provide a basic, default configuration that should attach its module to your app with all of the basic functionality enabled.

  • Does the account that your website run under have Full Control access to your website's root folder?

    RequestReduce creates a folder (called RequestReduceContent by default) and writes its reduced content here. If it can't write it, RequestReduce will not work. While Write access is enough to allow RequestReduce to create the directory and write files to it, there may be instances where RequestReduce needs to Update or delete those files. Full Control access is required for that. If you are uncomfortable giving Full Control to your site's account. You could give Write access to the root and Full Control only to the directory that RequestReduce writes to. Without Full Control, most basic RequestReduce functionality should work, but you may see exceptions in RequestReduce's error feed and it will not be able to cleanup unused files.

  • Do you see the RequestReduceContent folder in your web root?

    If so, that usually means the necessary rights are available and the module is at least running.

  • Are there files in this folder?

    That would mean the RequestReduce Response filter is finding content and processing it.

  • Check the dashboard to see if RequestReduce has done any processing or is perhaps in the middle of processing a large batch of files. The dashboard can be accessed at http://<your site>/<RequestReduce virtual path>/dashboard and will display what has been processed, what is queued for processing and what is in the middle of being processed. If there is nothing on this page, that is evidence that RequestReduce has not attempted or has failed to catch scripts and css on your site. If the page simply does not render or results in a 404, this is indication that the module is not properly installed.

  • Do you have Output Caching enabled on your content?

    If you do,this may explain why you see files in the RequestReduceContent folder but continue to see unminified content. RequestReduce is compatible with standard OutputCaching but depending on your cache duration time, it may take a while before you see the reduced content. For example, if your duration is 120 seconds, it may take a couple minutes before you see RequestReduce's optimizations. If it is set to hours, it may appear as though RequestReduce is not working at all since it will be hours before the optimizations are visible..

  • Is there another Response Filter in your Application that does not play nice with other Response Filters?

    RequestReduce performs its optimizations via a Response Filter. Applications can have multiple filters running but if one filter is not implemented correctly, this may lead to Bizarre markup when running with RequestReduce. A Response Filter must derrive from System.IO.Stream. The filter overrides the void Write(byte[] buffer, int offset, int count) method to output its filtered content to the browser. A common mistake is ignoring the offset or count parameters and operating on the entire buffer and then writing out the entire buffer and not limiting the output to the portion of the buffer within the offset and length. While this may very well work on most pages that have a single filter attached. It will certainly break RequestReduce and does not comply with the intent of the Stream's Write functionality. See this blog post for more detail. Also, if you are compressing the response within a filter, RequestReduce will be unable to perform any reduction on the compressed content if it is downstream of your filter. Its best to use the native IIS compresion instead.

  • What kind of pages are running on your site? Static Html?

    Replace static compression with dynamic compression. The satic compression handler may cache content and prevent you from seeing the reduced content.

To use dynamic compression, add this to your web.config:

<system.webServer>
    <handlers>
        <add name="html" path="*.html" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule"
scriptProcessor="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll"
preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
    </handlers>
</system.webServer>

While the dynamic compression does have some added processing overhead, it is quite minimal. Keep the static compression enabled Always make sure that both static and dynamic compression are enabled.

  • Do not set dynamicCompressionBeforeCache to true. Keek the IIS default of false. There is little to gain by setting this to true and it will shut down RequestReduce since the html will be compressed and therefore unparsable.

  • Are the images you are expecting to sprite, CSS background images?

    Currently, RequestReduce does not sprite foreground images. It only sprites background images in your CSS.

  • If your scripts are not being merged and minified, do they have anti caching headers?

    RequestReduce will not touch scripts with a Cache-Control header set to no-store or no-cache or with an Expires or max-age header less that 1 week.

  • Do your CSS and javascripts emit the standard javascript and css mime content type headers?

    RequestReduce will not process any css or javascript that has non css or javascript content type headers.

  • Are the CSS and Javascript urls valid and accessible via HTTP/S from your web server?

    If you cannot open a browser and access these urls, neither can RequestReduce.

    If your site is running on HTTPS and you are using a self signed certificate in a dev environment, make sure that certificate has a common name that matches the host name you are using and resides in the trusted certificate authority certificate store. Here is a powershell script that can create a self signed certificate:

if(-not(Test-Path cert:\localmachine\my | where-object { $_.Subject -eq "CN=*.$domain" })) {
    & utilities\makecert -r -pe -n "CN=*.$domain" -sky exchange -ss my -sr localmachine temp.cer
    & utilities\CertMgr /add temp.cer /s /r localMachine root  
    Remove-Item temp.cer
}
$thumb = (Get-ChildItem cert:\LocalMachine\my | where-object { $_.Subject -eq "CN=*.$domain" } | Select-Object -First 1).Thumbprint
if(Test-Path IIS:\SslBindings\0.0.0.0!443) { Remove-Item -force -Recurse IIS:\SslBindings\0.0.0.0!443 }
Push-Location IIS:\SslBindings
Get-Item cert:\LocalMachine\my\$thumb | New-Item 0.0.0.0!443
Pop-Location

This assumes that $domain is equal to your host domain. Since I work at microsoft, for us it is microsoft.com and my local machine which is mwrock1.redmond.corp.microsoft.com falls under *.microsoft.com. If you use localhost, you would change the script to remove the wildcard. It also assumes that makecert the windows SDK utility for creating certs is in /utilities. Not sure off hand where it is located originally and some machines may have it in their path.

  • Do your CSS or Javascript urls require authentication? RequestReduce will not be able to access sites that require authentication.

  • Try intercepting errors thrown by RequestReduce when processing content

    Every environment is different and while I ave Designed RequestReduce to accommodate most environments, there are always new scenarios I never anticipated that do not play nice with RequestReduce and may cause exceptions to be thrown. RequestReduce will catch all errors and can pass them on to your error handler for your review or for you to report on this site's issues list.

To intercept RequestReduce exceptions, simply register a lambda or delegate to the RequestReduce static CaptureErrorAction property of the RequestReduceModule class. Here is how you can do this by placing this in your global.asax:

private static StringBuilder errorBuffer = new StringBuilder();

void Application_Start(object sender, EventArgs e) 
{
    RequestReduceModule.CaptureErrorAction = BuildErrorMessage;
}

private void BuildErrorMessage(Exception ex)
{
    errorBuffer.AppendLine(ex.ToString());
    if(ex.InnerException != null)
        BuildErrorMessage(ex.InnerException);
}

void Application_BeginRequest(object sender, EventArgs e)
{
    if (Request.QueryString["OutputError"] == null) return;

    Response.Write(errorBuffer.ToString());
    errorBuffer.Remove(0, errorBuffer.Length);
    Context.ApplicationInstance.CompleteRequest();
}

Now, by adding the OutputError=1 querystring pair to any url on your site, RequestReduce will output any exceptions that have been accumulating. This can provide insight into what is wrong in your environment preventing RequestReduce from processing your content.

  • Turn on tracing.

    If all else fails, you can enable tracing which writes verbose debugging information to a text file.

In order to turn this on, you must be running a debug build and you must be in a Full Trust environment.

  1. Get a debug build of RequestReduce. To do this either fork the RequestReduce source or download it from this site.
  2. Open a powershell prompt at the directory where you installed equestReduce and enter ./build build-output debug.
  3. Copy the dll and pdb file in \RequestReduce\Nuget\Lib\net to your bin folder.
  4. Make sure your Web.config has debug mode set to true by including <compilation debug="true" /> inside of <system.web>.
  5. Add this to your web.config:

<system.diagnostics>
  <trace autoflush="false" indentsize="4">
    <listeners>
      <add name="fileListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="TraceOutput.log" />
      <remove name="Default" />
    </listeners>
  </trace>
</system.diagnostics>

Run your web application and navigate to pages you would expect RequstReduce to process.

Now there should be a file called TraceOutput.log in your web root directory with detailed information regarding exactly what RequestReduce has been doing. Please attach this file to an issue on this site and report the problems you have been having.

Other things that are helpful when reporting issues:

  • A copy of your web.config (redacted as appropriate).
  • A url to a publicly accessible address where you are having problems with RequestReduce.
  • If you can not provide your web.config, it is helpful to know what other HttpModules ate loaded on your site.
Something went wrong with that request. Please try again.