I want to bundle and minify my JS/CSS files. To do this, i am using Combres.
我想捆绑和缩小我的JS / CSS文件。要做到这一点,我正在使用Combres。
I've set up the Combres solution on my local environment, and it works there. However, when I deploy my application to the IIS, it doesn't work. Um-hm. The url I try to access is http://www.mysite.com/combres.axd/siteJs/-1639413070/ .
我在我的本地环境中设置了Combres解决方案,它在那里工作。但是,当我将我的应用程序部署到IIS时,它不起作用。 UM-HM。我尝试访问的网址是http://www.mysite.com/combres.axd/siteJs/-1639413070/。
I get an IIS 404 error: 404 - File or directory not found.
我收到IIS 404错误:404 - 找不到文件或目录。
This is my setup.
这是我的设置。
Web.config:
Web.config文件:
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
<section name="dotless" type="dotless.Core.configuration.DotlessConfigurationSectionHandler, dotless.Core" />
<section name="combres" type="Combres.ConfigSectionSetting, Combres, Version=2.2, Culture=neutral, PublicKeyToken=1ca6b37997dd7536" />
</configSections>
<appSettings>
<add key="ChartImageHandler" value="storage=session;timeout=20;"/>
<add key="CombresSectionName" value="combres" />
</appSettings>
<system.web>
<httpModules>
<add name="MinifyHtml" type="GKBusiness.HtmlMinifier.MinifyHtmlClass,GKBusiness"/>
</httpModules>
<globalization culture="da-DK" uiCulture="da-DK"/>
<httpHandlers>
<add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
<add path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler, dotless.Core" />
</httpHandlers>
<pages controlRenderingCompatibilityVersion="4.0" enableViewState="true">
<controls>
<add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</controls>
<namespaces>
<add namespace="Combres"/>
</namespaces>
</pages>
<compilation debug="false" targetFramework="4.5">
<assemblies>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies>
</compilation>
<httpRuntime requestValidationMode="2.0"/>
</system.web>
<system.webServer>
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll"/>
<dynamicTypes>
<add mimeType="text/*" enabled="true"/>
<add mimeType="message/*" enabled="true"/>
<add mimeType="application/javascript" enabled="true"/>
<add mimeType="*/*" enabled="false"/>
</dynamicTypes>
<staticTypes>
<add mimeType="text/*" enabled="true"/>
<add mimeType="message/*" enabled="true"/>
<add mimeType="application/javascript" enabled="true"/>
<add mimeType="*/*" enabled="false"/>
</staticTypes>
</httpCompression>
<urlCompression doStaticCompression="true" doDynamicCompression="true"/>
<modules runAllManagedModulesForAllRequests="true">
<add name="MinifyHtml" type="GKBusiness.HtmlMinifier.MinifyHtmlClass,GKBusiness"/>
</modules>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
<remove name="ChartImageHandler"/>
<add name="AjaxToolkit" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="dotless" path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler,dotless.Core" resourceType="File" preCondition="" />
</handlers>
<log4net>
<appender name="File" type="log4net.Appender.RollingFileAppender">
<file type="log4net.Util.PatternString" value="Logs\\log_%date{yyyyMMdd}.txt"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyyMMdd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline"/>
</layout>
<filter type="log4net.Filter.LevelRangeFilter">
<param name="LevelMin" value="INFO"/>
<param name="LevelMax" value="OFF"/>
</filter>
</appender>
<logger name="File">
<level value="All"/>
<appender-ref ref="File"/>
</logger>
<root>
<level value="ALL"/>
<appender-ref ref="File"/>
</root>
</log4net>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Fasterflect" publicKeyToken="38d18473284c1ca7" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.2.0" newVersion="2.1.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="AjaxMin" publicKeyToken="21ef50ce11b5d80f" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.48.4489.28432" newVersion="4.48.4489.28432" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<dotless minifyCss="false" cache="true" web="false" />
<combres definitionUrl="~/App_Data/combres.xml" />
</configuration>
Combres.xml:
Combres.xml:
<combres xmlns='urn:combres'>
<filters>
<filter type="Combres.Filters.FixUrlsInCssFilter, Combres" />
</filters>
<resourceSets url="~/combres.axd"
defaultDuration="30"
defaultVersion="auto"
defaultDebugEnabled="auto"
defaultIgnorePipelineWhenDebug="true"
localChangeMonitorInterval="30"
remoteChangeMonitorInterval="60"
>
<resourceSet name="siteCss" type="css">
<resource path="~/Resources/Plugins/bootstrap.min.css" />
<resource path="~/Resources/Plugins/bootstrap-responsive.min.css" />
<resource path="~/Resources/Styles/jquery-ui.css" />
<resource path="~/Resources/Styles/screen.css" />
</resourceSet>
<resourceSet name="siteJs" type="js">
<resource path="~/Resources/Plugins/bootstrap.min.js" />
<resource path="~/Resources/Plugins/TagIt/js/tag-it.js" />
</resourceSet>
</resourceSets>
</combres>
Rendered HTML:
呈现的HTML:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>
<link rel="stylesheet" type="text/css" href="/combres.axd/siteCss/-489484553/"/><script type="text/javascript" src="/combres.axd/siteJs/-1639413070/"></script>
And when I enter a link, like http://www.mysite.com/combres.axd/siteJs/-1639413070/ , it gives the IIS 404 error.
当我输入一个链接,如http://www.mysite.com/combres.axd/siteJs/-1639413070/时,它会给出IIS 404错误。
I can get it to run by setting "defaultDebugEnabled" to false, but then of course, it doesn't work.
我可以通过将“defaultDebugEnabled”设置为false来运行它,但当然,它不起作用。
I've made sure the NetworkService / IISuser has full access to my folder.
我已确保NetworkService / IISuser对我的文件夹具有完全访问权限。
Any ideas why my handler falls?
任何想法为什么我的处理程序落
2 个解决方案
#1
4
I had the same problem. but i got it fixed by adding
我有同样的问题。但我通过添加修复它
<add name="RoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
to the system.webserver\modules , and
到system.webserver \ modules,和
<add name="UrlRoutingHandler" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" verb="*"/>
to System.webserver\handlers in my web.config
到我的web.config中的System.webserver \ handlers
this did the job for me.
这对我有用。
#2
0
I think i figured it out. Had the same problem when i went from development to production.
我想我想通了。当我从开发到生产时遇到同样的问题。
i added the routing module to the system.web\httpModules list. Which made my solution work .
我将路由模块添加到system.web \ httpModules列表中。这使我的解决方案有效。
#1
4
I had the same problem. but i got it fixed by adding
我有同样的问题。但我通过添加修复它
<add name="RoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
to the system.webserver\modules , and
到system.webserver \ modules,和
<add name="UrlRoutingHandler" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" verb="*"/>
to System.webserver\handlers in my web.config
到我的web.config中的System.webserver \ handlers
this did the job for me.
这对我有用。
#2
0
I think i figured it out. Had the same problem when i went from development to production.
我想我想通了。当我从开发到生产时遇到同样的问题。
i added the routing module to the system.web\httpModules list. Which made my solution work .
我将路由模块添加到system.web \ httpModules列表中。这使我的解决方案有效。