Combres link generates 404 for JS, but works for CSS

Jan 9, 2011 at 10:28 PM

I'm having a few problems getting Combres 2.1 to work in a production environment. If I set defaultIgnorePipelineWhenDebug to true in ~/App_Data/Combres.xml, then the CSS and JS tags are written out correctly, which is good.

However, when I remove the defaultIgnorePipelineWhenDebug value (or set it to false) then the following occurs:

  1. CSS appears to be working correctly - I've got  an HTTP 304 Not Modified status, I can see an Etag and all the nice cacheing HTTP headers that Combres brings to the table. Score one for the good guys there!
  2. JS does not appear to be working correctly. Although the script reference to combres.axd has been correctly generated, the reference itself is a 404 Not Found. Even if I just browse to localhost/combres.axd, I get a 404.

I'm running Windows 7 Ultimate 64-bit. My combres.xml is listed below:

<?xml version="1.0" encoding="utf-8" ?>
<combres xmlns='urn:combres'>
  <cssMinifiers>
    <minifier name="yuiCss" type="Combres.Minifiers.YuiCssMinifier, Combres">
      <param name="CssCompressionType" type="string" value="StockYuiCompressor" />
      <param name="ColumnWidth" type="int" value="-1" />
    </minifier>
  </cssMinifiers>
  <!--<jsMinifiers>
    <minifier name="yuiJs" type="Combres.Minifiers.YuiJSMinifier, Combres">
    </minifier>
  </jsMinifiers-->
  <resourceSets url="~/combres.axd"
                defaultCssMinifierRef="yuiCss"
                defaultDebugEnabled="false"
                defaultDuration="30"
                defaultVersion="auto"
                defaultIgnorePipelineWhenDebug="false">
    <resourceSet name="baseCss" type="css">
      <resource path="~/App_Themes/default/base.css" />
    </resourceSet>
    <resourceSet name="minimalJs" type="js">
      <resource path="~/Scripts/alerts.js" />
      <resource path="~/Scripts/constants.js" />
      <resource path="~/Scripts/windowController.js" />
    </resourceSet>
    <resourceSet name="standardJs" type="js">
      <resource reference="minimalJs" />
      <resource path="~/Scripts/AC_OETags.js" />
      <resource path="~/Scripts/client.js" />
      <resource path="~/Scripts/CustomerSearch.js" />
      <resource path="~/Scripts/Customers.js" />
      <resource path="~/Scripts/JScript_Message.js" />
      <resource path="~/Scripts/JobDetailsControl.js" />
      <resource path="~/Scripts/JobDetailsPage.js" />
      <resource path="~/Scripts/ScheduleList.js" />
      <resource path="~/Scripts/Workboard.js" />
    </resourceSet>
  </resourceSets>
</combres>

and my web.config:

<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="combres" type="Combres.ConfigSectionSetting, Combres, Version=2.1.0.0, Culture=neutral, PublicKeyToken=1ca6b37997dd7536"/>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, Combres, Version=2.1.0.0, Culture=neutral, PublicKeyToken=1ca6b37997dd7536"/>
  </configSections>
  <combres definitionUrl="~/App_Data/combres.xml" logProvider="Combres.Loggers.Log4NetLogger" />
  <log4net>
    <root>
      <level value="ALL"/>
      <appender-ref ref="RollingFile"/>
    </root>
    <logger name="Combres">
      <level value="DEBUG"/>
    </logger>
    <appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
      <file value="log.txt"/>
      <appendToFile value="true"/>
      <maximumFileSize value="100KB"/>
      <maxSizeRollBackups value="2"/>
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%d [%t] %-5p %c - %m%n"/>
      </layout>
    </appender>
  </log4net>
  <system.web>
    <!-- 
            Set compilation debug="true" to insert debugging 
            symbols into the compiled page. Because this 
            affects performance, set this value to true only 
            during development.
        -->
    <compilation debug="true" defaultLanguage="c#">
      <assemblies>
        <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      </assemblies>
    </compilation>
    <pages theme="default" enableEventValidation="true" enableSessionState="true" buffer="true" validateRequest="true" viewStateEncryptionMode="Never">
      <controls>
        <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add tagPrefix="cb" namespace="Combres" assembly="Combres, Version=2.1.0.0, Culture=neutral, PublicKeyToken=1ca6b37997dd7536"/>
      </controls>
    </pages>
    <httpHandlers>
      <remove verb="*" path="*.asmx"/>
      <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
    </httpHandlers>
    <httpModules>
      <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/><add name="HttpUtility" type="HttpUtility"/>
    </httpModules>
  </system.web>
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
        <providerOption name="CompilerVersion" value="v3.5"/>
        <providerOption name="WarnAsError" value="false"/>
      </compiler>
    </compilers>
  </system.codedom>
  <!-- 
        The system.webServer section is required for running ASP.NET AJAX under Internet
        Information Services 7.0.  It is not necessary for previous version of IIS.
    -->
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules>
      <remove name="ScriptModule"/>
      <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </modules>
    <handlers>
      <remove name="WebServiceHandlerFactory-Integrated"/>
      <remove name="ScriptHandlerFactory"/>
      <remove name="ScriptHandlerFactoryAppServices"/>
      <remove name="ScriptResource"/>
      <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </handlers>
    <directoryBrowse enabled="true"/>
  </system.webServer>
  <runtime>
    <assemblyBinding appliesTo="v2.0.50727" xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

The Combres output when run from a page in the root folder of the application is:

<script type="text/javascript" src="/schedulev3/combres.axd/minimalJs/-805698659/"></script>
<link href="App_Themes/default/base.css" type="text/css" rel="stylesheet" />

Does anyone have any idea what I'm doing wrong?

Jan 9, 2011 at 10:43 PM

I tried adding the UrlRoutingHandler as per this message, but it doesn't make any difference.

Jan 9, 2011 at 10:54 PM

Don't worry, I've found the problem - the IIS7 configuration wasn't correct, as per this article. Please could someone ensure that the documentation (or the sample on Code Project) makes these configuration changes clear?

Coordinator
Jan 22, 2011 at 11:42 AM

Hi!  What was the problem exactly and which changes did you make to fix it?  If you could post info here so that others know the solution when coming across the same issue, then it's much appreciated.