Thursday, April 09, 2009

How to troubleshoot SQL connection issues


Had a problem with remote web app not connection to newly installed SQL Server. Was getting generic “A network-related or instance-specific error occurred while establishing a connection to SQL Server…”

Found this great article with the breakdown of possible scenarios, very useful. Mine was #6, SQLBrowser not running. Was clicking too fast through the installation ;-)

Monday, April 06, 2009

Find of the day - Mozilla specific client caching


Looks like Mozilla stores documents locally even if "no-cache" header is passed in the HTTP response.
Official explanation here.

Wednesday, April 01, 2009

Silverlight Client Caching


Since SL creates a XAP file for further consumption, browsers will be caching it as a usual asset. While being awesome for production, it introduces a pain in the development process as you need to clear the temporary files in your browser to see the change.

In order to get rid of this inconvenience, just turn off the caching on the IIS level. If you are on IIS7, extend "Output Caching" options by introducing a rule for ".xap" files and specify "cache using file change notifications ":

Untitled

In order to confirm it worked, fire up Fiddler and verify you get "no-cache" for the request to XAP file.

Cookie sharing between processes in Internet Explorer


If you installed IE8 and tried running two separate Sitecore sessions in different processes, you may have experienced this as well.
IE8 shares the cookies between two different processes (windows) now so this may bring you inconvenience especially during the development process.

There are solutions out there which address the problem with special "-nomerge" parameter, but I decided to apply the registry fix directly so all my IE launches will not use this new "FrameMerging" feature that supposedly improves performance.

Related reading:
http://www.walkernews.net/2009/03/26/use-ie8-nomerge-option-to-login-multiple-accounts-of-same-site/ http://www.walkernews.net/2009/04/02/alternative-ie8-nomerge-option-to-login-multiple-web-accounts/
http://www.microsoft.com/communities/newsgroups/list/en-us/default.aspx?dg=microsoft.public.internetexplorer.beta&tid=3d227efa-d0a1-4ec7-896e-2722c4026e62&cat=&lang=&cr=&sloc=&p=1

Registry fix from the article above:
HKCU\software\microsoft\internet explorer\main - FrameMerging = DWORD:0

Update 2/29/2012:

The registry key that disables this mess once and forever is actually called “SessionMerging” which can be found under:
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main
SessionMerging = DWORD:0

Works for IE9 too!

Tuesday, March 31, 2009

Attach WCF services to Sitecore context


As you know, any stand-alone .NET resource such as ASPX webform or web service can be associated with a Sitecore context. With this in place, will be able to access all nice stuff from Sitecore.Context such as "ContentDatabase", "Domain", etc.

In order to do that, you can just drop the resource into one of the folders referenced by a site definition in the <sites> section.
For example, if your stand-alone resource is working with the back-end, "modules_shell" would be the best option:

<site name="modules_shell" virtualFolder="/sitecore modules/shell" physicalFolder="/sitecore modules/shell" rootPath="/sitecore/content" startItem="/home" language="en" database="core" domain="sitecore" content="master" enableWorkflow="true" />

As you can see, the "modules_shell" site is referencing the "/sitecore modules/shell" folder, so this would be the location for your resource.

It works great for aspx and asmx resources but fails for a WCF service that you may be using.
The reason for that is the FilterUrlExtensions processor in preprocessRequest pipeline that does not allow SVC extensions through. If you simply adjust the value of the first "allowed extensions"  parameter as it is shown below, your WCF service will be able to access Sitecore context:
<processor type="Sitecore.Pipelines.PreprocessRequest.FilterUrlExtensions, Sitecore.Kernel">
   <param desc="Allowed extensions (comma separated)">aspx, ashx, asmx, svc</param>
   <param desc="Blocked extensions (comma separated)">*</param>
   <param desc="Blocked extensions that stream files (comma separated)">*</param>
   <param desc="Blocked extensions that do not stream files (comma separated)"></param>
</processor>

Note, there are two processors with the same class name in web.config so don't confuse it with the one defined in the httpRequestBegin pipeline.