Combined, but .xcr not being read in browser when debugging.

Feb 1, 2013 at 1:21 PM
I am trying to get Xpedite working in my development environment on my local machine and I can see where my CSS and Javascript files are combined and minified, but they are not working in the site due to the .xcr extension. I have put the httphandler lines in my web.config, but it seems that this does not fix the issue. I am using Visual Studio 2010 Ultimate on Windows 7.

As I said the files are being combined and minified, but not able to be used in the site. Any ideas?
Coordinator
Feb 1, 2013 at 2:08 PM
Hi,

Depending on whether you are running in IIS, IIS Express or Cassini, you will have to configure the appropriate handlers in you web.config file. You can find a sample web.config file in the SampleMvcApplication

For IIS/IIS Express you have to use:
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules runAllManagedModulesForAllRequests="true"/>
    <handlers>
      <add name="CssMinifier" verb="GET,HEAD" path="*.css" type="Xpedite.Handlers.CssMinificationHandler, Xpedite, PublicKeyToken=a255fab67ac3163b"/>
      <add name="JavaScriptMinifier" verb="GET,HEAD" path="*.js" type="Xpedite.Handlers.JavaScriptMinificationHandler, Xpedite, PublicKeyToken=a255fab67ac3163b"/>
      <add name="XpediteResources" verb="GET,HEAD" path="*.xcr" type="Xpedite.Handlers.CompositeResourceHandler, Xpedite, PublicKeyToken=a255fab67ac3163b"/>
    </handlers>
  </system.webServer>
For Cassini, you have to use:
  <system.web>
    <httpHandlers>
      <add verb="GET,HEAD" path="*.css" type="Xpedite.Handlers.CssMinificationHandler, Xpedite, PublicKeyToken=a255fab67ac3163b"/>
      <add verb="GET,HEAD" path="*.js" type="Xpedite.Handlers.JavaScriptMinificationHandler, Xpedite, PublicKeyToken=a255fab67ac3163b"/>
      <add verb="GET,HEAD" path="*.xcr" type="Xpedite.Handlers.CompositeResourceHandler, Xpedite, PublicKeyToken=a255fab67ac3163b"/>
    </httpHandlers>

  </system.web>
In some cases, you may have to register the XCR extension with IIS (if running classic mode I believe); should not be required on Windows 7 though... Does the sample application run in your environment?

If you are still having issues, let me know and I will be happy to help.
Coordinator
Feb 1, 2013 at 2:09 PM
With regard to the above XML fragments, if you are running pure XCR requests (i.e., all CSS/JS will be combined), then you should not need to register the CssMinificationHandler or JavaScriptMinificationHandler.
Feb 1, 2013 at 2:44 PM
So this is just pressing F5 in VS so I am pretty sure that runs Cassini. The site will be running on IIS6 for production, but if I cannot get it working on my development machine then it will not go to production. So below are different parts from my web.config just to show what I have used.


web.config

  <configSections>
       <section name="xpedite" type="Xpedite.Config.ConfigSectionHandler, Xpedite, PublicKeyToken=a255fab67ac3163b" requirePermission="false"/>
        ....more here but left out...
  </configSections>
....more here but left out...
 <httpHandlers>
....more here but left out...
        <add verb="GET,HEAD" path="*.xcr" type="Xpedite.Handlers.CompositeResourceHandler, Xpedite, PublicKeyToken=a255fab67ac3163b"/>
  </httpHandlers>
....more here but left out...
    <xpedite mode="On">
        <css minifier="Xpedite.Minification.YuiCompressor.YuiCompressorCssMinifier, Xpedite.Minification.YuiCompressor, PublicKeyToken=a5fa8a719a542eb8" />
        <javascript minifier="Xpedite.Minification.YuiCompressor.YuiCompressorJavaScriptMinifier, Xpedite.Minification.YuiCompressor, PublicKeyToken=a5fa8a719a542eb8" />
    </xpedite>
Master Page:
<%@ Register Assembly="Xpedite" Namespace="Xpedite.WebControls" TagPrefix="xpedite" %>
....more here but left out...
     <xpedite:CompositeResourcePlaceholder ID="CompositeResourcePlaceholder1" runat="server" />
    <xpedite:CompositeResource runat="server" Type="Css" ReferenceName="css">
        <xpedite:Resource Url="~/Css/TabStdDesign.css" />
        <xpedite:Resource Url="~/Css/jquery-theme/jquery-ui-1.8.16.custom.css" />
        <xpedite:Resource Url="~/Css/jquery-ui.css" />
    </xpedite:CompositeResource>
    <xpedite:CompositeResource runat="server" Type="JavaScript" ReferenceName="js">
        <xpedite:Resource Url="~/js/jquery-1.4.2.min.js" />
        <xpedite:Resource Url="~/js/jquery-ui-1.8.16.custom.min.js" />
        <xpedite:Resource Url="~/js/jquery.searchabledropdown-1.0.7.src.js" />
        <xpedite:Resource Url="~/js/cufon-yui.js" />
        <xpedite:Resource Url="~/js/Formata_italic_700.font.js" />
        <xpedite:Resource Url="~/js/swap_image.js" />
    </xpedite:CompositeResource>
Feb 1, 2013 at 2:57 PM
Edited Feb 1, 2013 at 7:48 PM
So the example website worked. Now I am really confused as to why it will not work in this site.

UPDATE: I think this may be a security issue. Is there a way to tell Xpedite to make the path something other than the root for the path of the XCR file?

UPDATE 2: So I went through the source code for this DLL and found that if I edit the ResourceUrlGenerator.cs file to hard code a directory at the en of _rootVirtualPath I can run things as they are supposed to run. The issue is that we use forms authentication and all directories are locked down with the exception of a couple that are used for things like Javascript and CSS. I think as a addition to this DLL it would be great if we could specify what the path would be so that this is not an issue.
Coordinator
Feb 2, 2013 at 1:01 PM
Hi,

Thanks for the detailed investigation. I am in the middle of another project this weekend, if you would like to submit a pull request with an option to configure a relative path from the root for XCR's, I would be happy to review and pull in to the project.

Also, the following discussion documents the steps for configuring IIS6.