我想捆绑和缩小我的JS / CSS文件。为此,我using Combres。
我在我的本地环境中设置了Combres解决方案,它在那里工作。但是,当我将我的应用程序部署到IIS时,它不起作用。 UM-HM。我尝试访问的网址是http://www.mysite.com/combres.axd/siteJs/-1639413070/。
我收到IIS 404错误: 404 - 找不到文件或目录。
这是我的设置。
的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 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>
呈现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>
当我输入http://www.mysite.com/combres.axd/siteJs/-1639413070/之类的链接时,会出现IIS 404错误。
我可以通过将“defaultDebugEnabled”设置为false来运行它,但当然,它不起作用。
我已确保NetworkService / IISuser具有对我的文件夹的完全访问权限。
为什么我的经纪人会失败?
答案 0 :(得分:4)
我遇到了同样的问题。但我通过添加
来解决这个问题<add name="RoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
到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="*"/>
到我的web.config中的System.webserver \ handlers
这为我做了这份工作。
答案 1 :(得分:0)
我想我明白了。当我从开发到生产时遇到同样的问题。
我将路由模块添加到system.web \ httpModules列表中。这使我的解决方案工作。