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)
Related
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>
I am lost. I've got a Web project that comes with a config file and several parameters which need to be set differently per target environment. I have an app setting and a connection string. The DEFINE values need to be replaced.
Web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="HostUri" value="DEFINE"/>
...
</appSettings>
<connectionStrings>
<add name="DbConn" connectionString="DEFINE" providerName="System.Data.SqlClient"/>
</connectionStrings>
...
</configuration>
I've got a parameter specification which an Azure App Service Deploy task uses later during deployment. Here, I specified both values to be replaced.
parameters.xml:
<parameters>
<parameter name="HostUri" defaultValue="Replace me!">
<parameterEntry kind="XmlFile" scope="Web.config"
match="/configuration/appSettings/add[#key='HostUri']/#value" />
</parameter>
<parameter name="DbConn" defaultValue="Replace me!">
<parameterEntry kind="XmlFile" scope="Web.config"
match="/configuration/connectionStrings/add[#name='DbConn']/#connectionString" />
</parameter>
</parameters>
While the app setting HostUri is correctly replaced, the connection string DbConn stays untouched. I do not even get the default value set. It keeps its value DEFINE as originally set in the Web.config.
My gut tells me my XPath /configuration/connectionStrings/add[#name='DbConn']/#connectionString is incorrect, but it looks okay to me and follows what other posts have done, such as Cobus Bernard.
Any help is greatly appreciated.
I studied log files and found that MSBuild treats connection strings differently:
...
Adding declared parameter 'HostUri'.
Adding declared parameter 'DbConn'.
Adding declared parameter 'DbConn-Web.config Connection String'.
...
The last line led to an unwanted entry in the the generated file SetParameters.xml:
...
<setParameter name="HostUri" value="Replace me!" />
<setParameter name="DbConn" value="Replace me!" />
<setParameter name="DbConn-Web.config Connection String" value="DEFINE" />
...
So my XPath was correct, but this special directive put a DEFINE into my target Web.config. I found two solutions to this, primarily based on this SO question: How to Publish Web with msbuild?
1) Tweak your project file
Unload you Web project, edit the project file and add in your desired configuration the following line:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<!-- Add this line: --
<AutoParameterizationWebConfigConnectionStrings>False</AutoParameterizationWebConfigConnectionStrings>
...
</PropertyGroup>
The build process will pick this up and stops treating connection strings special.
I find this solution too hidden and people will forget so the alternative is a bit more explicit:
2) Configure MSBuild
Pass an explicit argument to MSBuild when the release package gets built:
msbuild /P:Configuration=Release;AutoParameterizationWebConfigConnectionStrings=false;...
I am totally new to IIS servers and need to implement some rewrites.
The following rule in my RewriteMaps file causes a 500 error:
<add key="/contenttemplates/news.aspx?id=8589976277&LangType=3081&CurrencyType=156" value="/" />
While this one works fine:
<add key="/offset-air.php" value="/" />
I can only assume the query string has something to do with the issue, but I struggle to find a reason as to why this URL would be an issue. Initial google attempts have come up empty.
I would be very grateful if someone could point me in the right direction.
Many Regards!
If your rewrite maps are causing you issues, you should consider encoding your urls correctly.
An & in the URL (in either the key or the value) should be replaced with an &.
<add key="/contenttemplates/news.aspx?id=8589976277&LangType=3081&CurrencyType=156" value="/" />
would then become:
<add key="/contenttemplates/news.aspx?id=8589976277&LangType=3081&CurrencyType=156" value="/" />
I have a domain group with space in it, it does not work. The only related thing I find on google is this unanswered question
http://webclientguidance.codeplex.com/discussions/9242
<rules>
<add name="User" expression="R:MyDomain\MyApp Users" />
</rules>
I am getting this exception :
Found token "end of file" when expecting word at position 17.
The solution was painful simple
<add name="User" expression="R:"MyDomain\MyApp Users"" />
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.