How to compress all files with IIS - iis

IIS compression has been enabled:
The following is the httpCompression tag of web.config:
<httpCompression
directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files"
minFileSizeForComp="1"
staticCompressionIgnoreHitFrequency="true"
dynamicCompressionIgnoreHitFrequency="true">
<dynamicTypes>
<add mimeType="*/*" enabled="true" />
</dynamicTypes>
<staticTypes>
<add mimeType="*/*" enabled="true" />
</staticTypes>
</httpCompression>
I see only CSS and JavaScript files are compressed when running the web app:
Unfortunately, other files are not compressed:
I do not seee "IIS Temporary Compressed Files" in "C:\inetpub\temp".
Could anyone provide a tip on how to diagnose this?
Update[2020-08-13]
Configuration Editor on Windows Server 2016:
Update[2020-08-13]
Per #Kul-Tigin, Dynamic Content Compression needs to be installed:

There's no such a setting named dynamicCompressionIgnoreHitFrequency, remove it.
1 (in bytes) for minFileSizeForComp is a little bit harsh. Compressing small files just decreases the response size.
Leave it 2700 as default.
Unlike setting values on attributes (like you did in staticCompressionIgnoreHitFrequency="true"), adding a setting as node won't override inherited ones.
Before adding, removing possibly inherited corresponding setting or clear all the inherited ones is a good practice to prevent errors (especially silent ones).
Otherwise an error may occur or worse a silent error may break your setting.
100 (in MB) for per application pools space limit may be insufficient for your needs. If I recall correctly most of your files are webassembly files of megabaytes.
Since you want all files to be compressed if possible; specify a value big enough.
Big as if possible; the sum of the uncompressed lengths of all your files. Say 2048 MB.
With this way you can't reach the disk space limit so none of your compressed caches are not deleted due to lack of space.
As long as the original file has not changed, the compressed caches survive and be delivered.
I have 3 years old compressed cache files stored on my servers, ready to be delivered BTW.
So, give the following a try.
If it does not work, please provide more information about request headers and the files that are delivered as uncompressed.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpCompression
sendCacheHeaders="false"
directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files"
doDiskSpaceLimiting="true"
maxDiskSpaceUsage="2048"
minFileSizeForComp="2700"
noCompressionForHttp10="true"
noCompressionForProxies="true"
noCompressionForRange="true"
staticCompressionIgnoreHitFrequency="true"
staticCompressionDisableCpuUsage="100"
staticCompressionEnableCpuUsage="50"
dynamicCompressionDisableCpuUsage="90"
dynamicCompressionEnableCpuUsage="50"
dynamicCompressionBufferLimit="65536">
<dynamicTypes>
<clear />
<add mimeType="*/*" enabled="true" />
</dynamicTypes>
<staticTypes>
<clear />
<add mimeType="*/*" enabled="true" />
</staticTypes>
</httpCompression>
</system.webServer>
</configuration>

Related

NLog Archive configuration

In some of my programs I have a 30 day rotation as expected with multiple entries from several months, but only 30 log files. In other programs, I have only one day's worth of log files, but still only 30 log files total. What I want to have is just the log file entries from the last 30 days with 30 log files. I guess I don't know what I am missing.
Yesterday one of my log files was overwritten when the program started back up so I lost the data that would tell me what happened. Then my second question is, does archiving just remove the files that don't fit the pattern or does it actually take the log files and put them somewhere? What really is archiving? Here is my nlog.config:
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!--
See https://github.com/nlog/nlog/wiki/Configuration-file
for information on customizing logging rules and outputs.
-->
<variable name="LogDir" value="${specialfolder:folder=MyDocuments}/MyApp/Log"/>
<variable name="LogDay" value="${date:format=dd}"/>
<targets async="true">
<!-- add your targets here -->
<target name="LogTarget1"
xsi:type="File"
fileName="${LogDay}.log"
encoding="utf-8"
maxArchiveFiles="30"
archiveNumbering="Sequence"
archiveAboveSize="52428800"
archiveFileName="${LogDay}.{#######}.log"
layout="${date:format=MM/dd/yyyy HH\:mm\:ss}|${level:uppercase=true}|${message}" />
</targets>
<rules>
<!-- add your logging rules here -->
<logger name="*" minlevel="Trace" writeTo="LogTarget1" />
</rules>
</nlog>
This is a shortcoming of NLog which isn't documented well.
When files should be deleted (e.g. max archives files) then the log files and archive files can't be in the same folder.
So one fix for this config would be to change the archifeFilePath to
archiveFileName="archive/${LogDay}.{#######}.log"
See also this issue on GitHub

Installshield changing <clear /> to <clear></clear> and breaking the service

My source xml looks like this :
<connectionStrings>
<clear />
<add name="StrConn" providerName="SQLNCLI10"
connectionString="Server=dbserver;Database=db;User Id=user;Password=pass;" />
</connectionStrings>
Notice the seemingly innocent <clear /> tag.
Once I've imported this xml, and made changes to the xml file i.e: the connection string. All single tags in the document like <add /> or <clear /> are rewritten to long form eg: <clear></clear> and this prevents my service / app from even running.
It seems crazy since ultimately it seems like valid XML, but yeah it dies with an unknown fault exception, but when replacing the clear tags to all be <clear /> and not <clear ></clear> it works.
How can I prevent installshield from transforming these tags?
Are you using the 'update xml' feature? Try using the 'udpate text file' instead. That's a bit ugly to use for xml files but it works (we've been using it before the update xml feature was introduced)

How to turn off ImageResizer file size limit in Orchard?

I am using the MediaProcessing Module in Orchard V1.7. The source images are large TIFF files (typically up to 4928 x 3264 pixels). I have two filters set up on the image profile:
Resize to 200 x 200
Format the image to Jpg
When I display the page I get an exception logged
2013-08-12 16:30:55,982 [22] Orchard.MediaProcessing.Shapes.MediaShapes - An error occured while rendering shape Lightbox for image /OrchardLocal/Media/Default/Stamps%20of%20Australia/ClaytonTremlett244.tif
ImageResizer.Plugins.Basic.SizeLimits+SizeLimitException (0x80004005):
The dimensions of the output image (2668x3364) exceed the maximum permitted dimensions of 3200x3200.
ImageResizer documentation states that the default maximum file size for output is 3200 x 3200, but I am requesting a size of 200 x 200. I have logged this as an issue (1642).
My question is, does anyone know how to turn off the maximum file size limit check for ImageResizer when it is used through the ImageResizer managed API, as Orchard has chosen to do?
Make sure you resize first, then change the format.
You can do it by setting "totalBehavior" to "ignorelimits". You can also set up totalWidth/totalHeight.
http://imageresizing.net/plugins/sizelimiting
In your web.config/app.config add below sections (or change them if they exist):
<configuration>
<configSections>
....
<section name="resizer" type="ImageResizer.ResizerSection"
requirePermission="false" />
</configSections>
<appSettings>
....
</appSettings>
<resizer>
<pipeline fakeExtensions=".ashx" defaultCommands="autorotate.default=true"/>
<plugins>
<add name="DiskCache" />
<add name="SizeLimiting" />
....
</plugins>
<sizelimits totalBehavior="ignorelimits" />
</resizer>
...

Unset Additional info in Magento

I am wondering how to unset product additional info in layout.xml.I created local.xml and used <action method="unsetChild"><name></name>product_additional_data</name>.
But it is not working.Any suggestions?
Your XML snippet is badly formed. It looks like you were attempting:
<action method="unsetChild"><name>product_additional_data</name></action>
You might also try this:
<remove name="product_additional_data" />

DIV identified by WebDevToolbar isnt in file?

I'm trying to use Magento for my shopping cart and want to switch from a right col layout to left col. I've turned on ID/CLASS display on the Web Developer Toolbar in firefox, and am seeing ".main col2-right-layout", which i believe i must switch to ".main col2-left-layout", the alternate style is predefined. but running searches for files with the phrase "col2-right-layout" in them is only pulling up the style sheet. I am searching THE ENTIRE Magento directory. How is this possible? Not case sensitive, and I'm even searching hidden folders. How can it be?
**i have looked in that file, the div is not mentioned. **
Files are in app/layout/default/default/templates/page/
I've not got a dev copy of magento at home, thats all I can remember off the top of my head - will try and remember to confirm when at work.
If you want to swap the templates, you need to look in app/layout/default/default/layout/page.xml, plus some of the other xml files - the templates are defined there.
(Yes, magento's layout/templating system is complicated, and has a steep learning curve, but its worth it!)
col2-right-layout is mentioned in
app/design/frontend/base/default/template/page/2columns-right.phtml
or in Magento 1.3
app/design/frontend/default/default/template/page/2columns-right.phtml
If you want to swap the layout I'd suggest changing it in one of the layout xml files. For the shopping cart edit app/design/frontend/base/default/layout/checkout.xml
change
<checkout_cart_index translate="label">
<label>Shopping Cart</label>
<remove name="right"/>
<remove name="left"/>
<!-- Mage_Checkout -->
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
to
<checkout_cart_index translate="label">
<label>Shopping Cart</label>
<remove name="right"/>
<remove name="left"/>
<!-- Mage_Checkout -->
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
And similarly for the checkout page in the same file change
<checkout_onepage_index translate="label">
<label>One Page Checkout</label>
<!-- Mage_Checkout -->
<remove name="left"/>
<reference name="root">
<action method="setTemplate"><template>page/2columns-right.phtml</template></action>
</reference>
to
<checkout_onepage_index translate="label">
<label>One Page Checkout</label>
<!-- Mage_Checkout -->
<remove name="left"/>
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
As always it is better to make a copy of the file you are editing to your own theme.

Resources