开发者

Combres' route (combres.axd) doesn't work

I have followed the article http://www.codeproject.com/KB/aspnet/combres2.aspx.

When I run my site I cannot get the combres.axd to work ? I know that the combres is running since an incorrect file in my xml will cause an error. I am running an ASP.NET 4.0 web forms site on vista.

My Combres XML settings are.

resourceSets url="~/combres.axd" defaultDuration="30" defaultVersion="auto" defaultDebugEnabled="auto"

I have checked the web.config for all correct values. The reference has been added from the merge directory and the global ASX file has the following.

protected void Application_Start(object sender, EventArgs e)
        {
            RouteTable.Rout开发者_运维技巧es.AddCombresRoute("Combres");
        }

I also checked the value is created in the html source.

href="/combres.axd/siteCss/309885723"

  src="/combres.axd/siteJs/408582048"

I do not get an error or anything to help me track down the reason it will not work or what I may have missed. Any suggestions would be great.


I had the same problem when trying to get it to work for the first time.

Make sure that the Combres route is added before the call to ignore the route {resource}.axd.

Correct:

RouteTable.Routes.AddCombresRoute("Combres");
RouteTable.Routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

Incorrect:

RouteTable.Routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
RouteTable.Routes.AddCombresRoute("Combres");


First, i'd suggest to hook a log4net to the combres logger in your web.config (don't forget to setup the configsection for log4net)

<log4net>
<logger name="Combres">
  <level value="ALL"/>
  <appender-ref ref="LogCombres" />
</logger>

<appender name="LogCombres" type="log4net.Appender.RollingFileAppender">
  <file value="Combres.log.txt"/>
  <appendToFile value="true"/>
  <maximumFileSize value="5000KB"/>
  <maxSizeRollBackups value="2"/>
  <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%d [%t] %-5p %c - %m%n"/>
  </layout>
</appender>
</log4net>

And in your global.asax launch the configuration

log4net.Config.XmlConfigurator.Configure()

You should have a detailed log of what's happening. If what's wrong doesn't pop out, don't hesitate to come back with some log output


For some reason the only way we could fix showing css in debug=false mode is by adding combres.axd to the anonymous access in web.config

  <location path="combres.axd">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>


What is your modules setting in web.config? Check for the runAllManagedModulesForAllRequests attribute.

<system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>

With a legacy WebForms app, I found I did not have that setting and once I put it in, the combres.axd route worked.

More on my question too


These are the changes i did in the project and it stated to run properly.

In the Global.asax file add these lines

using Combres;

In the application_start method

protected void Application_Start()
{
    RouteTable.Routes.AddCombresRoute("Combres");//Add this line
    RegisterRoutes(RouteTable.Routes);
} 

Comment out the line in Combres.cs file.


This happened to me too but the problem was from Yahoo.Yui.Compressor they changed one property signature in their new version 1.6*.

So to fix it i just down the Yahoo.Yui.Compressor to version 1.5.

And i'm happy now :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜