Me, Myself and Mayvelous

31 Aug 2012 18:00, A mouse ran pass under my legs at Sydney Hilton hotel lounge. A staff from the cafe and 3 guards ran after it with a bag. The mouse got trapped at the entrance rotating door but the man couldn’t catch him in the bag. After struggling for 3 min the mouse got away and jumped down the escalator beside the entrance. So the men followed. It was a palm size, quite big mouse with a long tail. Others screamed and jumped on the seats. I just stared and go oh oh oh and move my legs to make a way for the mouse to pass. I’m not scare of pests but if it was a worm crawling near me, I would have screamed my head off. I’m bad with wriggling slimy things. Anyways it’s a shame to see mouse running around at Hilton. It was unfortunate that my hands were occupied and couldn’t take a photo. Quite a first time remembrance at Hilton Hotel indeed.

The following things to note when you deploy a new Sitefinity site to production environment:

  1. Check the site authentication mode. It must have only one authentication. Check “Anonymous” and un-check “Integrated windows”
  2. Check Theme style link binding. Sometimes you need to add aspnet_isapi.dll wildcard in order to make the theme work again.
    IIS > Website > Properties > Home directory tab > Configuration > Wildcard application maps > Add (C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll)
    Make sure to UNCHECK “Verify that file exists” or you will have 404 errors everywhere.
  3. Check if your server have all required MIME types eg. Silverlight MIMEs
  4. Give the website folder “ASPNET” and “NETWORK SERVICE” WRITE access
  5. Reindex all your search indexes.
  6. Update your license file to correct site domain license

… will add more as I find things later.

  • Comments Off
  • Filed under: .Net,, Development, My To-Do List, Notes, Project Notes, Work
  • I deployed the Sitefinity site from local to DEV and STAGING servers and the document uploader works on DEV but suddendly disappear on the STAGING server.

    Correct Screen
    correct screen

    Error Screen
    blank document upload

    I’ve created a forum post but received no good answers. The dude kept asking me to install Silverlight Tools on all the machines. I don’t understand why we have to install silverlight on all machines and which silverlight exactly to install as there’re browser plugin, silverlight tools, silverlight framwork etc. And I cannot install silverlight tools unless the prerequisites, Visual Studio 2010 and Web Developer Express 2010, been installed which I absolutely don’t want to do. Also on the DEV server, there’s not a single instance of Silverlight installation was there and the uploader’s working just fine so I really had a hard time figuring out the issue with STAGING site. The forum responds were so slow, so I created a ticket and the same dude replied as followed:

    Can you enable Firebug and check what errors come up in the Net tab when you try to access the Upload section? Also is there a way to provide RDC to your server so I can inspect the settings in more depth?

    Ofcos I don’t want to give RDC access but I checked the Firebug and that really helps figure out the problem.
    With the help of Firebug, I got 404 file not found for Telerik.Sitefinity.Silverlight.xap file with the error below:

    Unhandled Error in Silverlight Application
    Code: 2104
    Category: InitializeError
    Message: 2104 An error has occurred.

    Now that’s some good hint, so I checked the path and the file exists on the server so must be the file permission issue; I googled the error message and found out that it’s all to do with missing MIME Types on STAGING server.

    mime types

    I’ve added these 3 types to the server MIME types list and it fixes the problem.

    .xap application/x-silverlight-app
    .xaml application/xaml+xml
    .xbap application/x-ms-xbap
    Ref: Configuration IIS for Silverlight Applications

    I wasn’t happy with the support but thank god he at least gave me a hint to check with Firebug.

    Whenever we upgrade to a new version of Sitefinity or applying service packs, we get something like the following version conflict errors:

    Could not load file or assembly ‘Telerik.Sitefinity, Version=…, Culture=neutral, PublicKeyToken=b28c218413bdf563′

    To fix that, place the assembly binding redirect info to the runtime section of your web.config and change the values of the “oldVersion” and “newVersion” acordingly. Your site should work again after a rebuild.

    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <assemblyIdentity name="Telerik.Sitefinity" publicKeyToken="b28c218413bdf563" />
    <bindingRedirect oldVersion="4.1.1574.0" newVersion="4.2.1650.0"/>
    <assemblyIdentity name="Telerik.Sitefinity.Model" publicKeyToken="b28c218413bdf563" />
    <bindingRedirect oldVersion="4.1.1574.0" newVersion="4.2.1650.0"/>

    Some of the most recent version numbers I’ve tracked are as followed:

    • Sitefinity 4.0 (4.0.1210.0)
    • Sitefinity 4.1 (4.1.1395.0)
    • Sitefinity 4.1 SP1 (4.1.1405.0)
    • Sitefinity 4.1 SP2 (4.1.1501.0)
    • Sitefinity 4.1 SP3 (4.1.1574.0)
    • Sitefinity 4.2 (4.2.1650.0)
    • Sitefinity 4.2 SP1 (4.2.1733.0)

    Another short note/ref to check out is this post on stackoverflow explaining some of the solution to version conflict error:

    “Found conflicts between different versions of the same dependent assembly”.

    Below is the direct quote from Brian which I find it pretty useful.:

    This warning means that two projects reference the same assembly (e.g. System.Windows.Forms) but the two project require different versions. You have a few options:

    1. Recompile all projects to use the same versions (e.g. move all to .Net 3.5). This is the preferred option because all code is running with the versions of dependencies they were compiled with.
    2. Add a binding redirect. This will suppress the warning. However, your .Net 2.0 projects will (at runtime) be bound to the .Net 3.5 versions of dependent assemblies such as System.Windows.Forms. You can quickly add a binding redirect by double-clicking on error in Visual Studio.
    3. Use CopyLocal=true. I’m not sure if this will suppress the warning. It will, like option 2 above, mean that all projects will use the .Net 3.5 version of System.Windows.Forms.

    Here is a utility to identify the offending reference(s):

    K that’s about it for now.

    I have this project setup for continuous integration with cruise control. It’s been up and running for quite sometime then suddenly the website starts getting the following errors on every successful build.

    Exception Details: System.BadImageFormatException: Could not load file or assembly ‘Microsoft.VisualBasic.Activities.Compiler’ or one of its dependencies. An attempt was made to load a program with an incorrect format.

    The Error Page
    Solution/Project Platform Target Configuration + Cruise Build

    I did not make any changes to the build configs at all and the site runs fine locally. There is no reference to ‘Microsoft.VisualBasic.Activities.Compiler‘ in my project and it doesn’t have VB code. I found some extra files, see below list, in the deployment bin while comparing the bin assemblies on deployment server and my local. Once remove those files, the site comes back on, but the files are added with every cruise build.

    • Microsoft.VisualBasic.Activities.Compiler.dll
    • Microsoft.Practices.ServiceLocation.dll
    • Microsoft.Practices.ServiceLocation.xml
    • mscorlib.dll
    • normidna.nlp
    • normnfc.nlp
    • normnfd.nlp
    • normnfkc.nlp
    • normnfkd.nlp
    • PresentationCore.dll
    • System.Data.dll
    • System.Data.OracleClient.dll
    • System.EnterpriseServices.dll
    • System.EnterpriseServices.Wrapper.dll
    • System.Printing.dll
    • System.Transactions.dll

    I google a bit to check similar problems out there and found only one link, which was fixed by installing missing SDK or something. I didn’t think that was the right solution for me but got an idea to check for target platform configuration on the solution and project files.

    I compare with one of my working project many times using visual studio property window to check for the solution and project file configuration properties but they seemed to be the same, using ANYCPU for the build platform. I didn’t trust the VS property designer so used WinMerge to compare the two files and found that there are some additional configuration lines added to the solution file. So I open the .sln and .csproj in notepad, removed all the extra configs, see the image below, checked back in, forced build the Cruise Control and walah all those craps gone and the site is back to the way it was.

    .sln Solution file comparison and the lines to remove
    Solution/Project Platform Target Configuration + Cruise Build

    .csproj Project file comparison and the line to remove
    Solution/Project Platform Target Configuration + Cruise Build

    The point I like to make here is that although no error with cruise build, your site can still be broken and freaking Visual Studio design views lie many time so remember to go for the good old way of editing it in notepad.

    Note: If you don’t have any working version to compare, just search for “Mixed Platforms” or “x86” in .sln file and “<PlatformTarget>AnyCPU</PlatformTarget>” in .csproj file and remove them accordingly.

    According to this post, we can reference the Sitefinity built-in script libraries and/or external script files in site master page as followed:

    <sf:JsFileLink id="jsLink" runat="server" ScriptType="jQuery"></sf:JsFileLink>
    <sf:JsFileLink id="jsLink" runat="server" ScriptType="prototype"></sf:JsFileLink>
    <sf:JsFileLink id="jsLink" runat="server" ScriptType="mooTools"></sf:JsFileLink>

    To use it, reference the assembly from the project and add the following code in the master page.

    <%@ Register Assembly="Telerik.Cms.Web.UI" Namespace="Telerik.Cms.Web.UI" TagPrefix="sf" %>

    It didn’t mention which version of Sitefinity it’s used at but after testing, found out that it’s definitly not for our current 4.1 SP2 version. The “JsFileLink” property is for older version of the sitefinity 3.6 etc which comes from Telerik.Cms.Web.UI assembly.

    Did a bit more digging around and got the right referencing for 4.1 version.

    1. Add this to master page, immediately after Page tag.

    <%@ Register TagPrefix="sf" Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.PublicControls"%>

    2. Place the following inside the “form” tag, NOT in the “head” section.

    If you have the “JS” folder location as mention in this structure, reference as followed:

    <sf:JavaScriptEmbedControl runat="server" ID="jsLink1" ScriptEmbedPosition="Head" Url="~/Sitefinity/WebsiteTemplates/YourSiteTemplates/JS/test.js"></sf:JavaScriptEmbedControl>

    If you have the script folder in your website root, use the following:

    <sf:JavaScriptEmbedControl runat="server" ID="jsLink2" ScriptEmbedPosition="Head" Url="~/scripts/test.js"></sf:JavaScriptEmbedControl>

    For built-in JQuery library, reference as followed:

    <sf:JavaScriptEmbedControl runat="server" ID="jQyeryLink" ScriptEmbedPosition="Head" ScriptType="jQuery"></sf:JavaScriptEmbedControl>

    3. Must have unique “ID” and specify “ScriptEmbedPosition” fields.

    The JavaScriptEmbedControl will register a script in the selected ScriptEmbedPosition (Head, InPlace, BeforeBodyEndTag). This control is also available in the page editor in the Scripts and Styles toolbox section. You can add references to scripts when editing the page through the UI, and even write inline scripts by hand. ref

    Place all the external JS link or code blocks at the end of the page rather than the “Head”. ie. use “BeforeBodyEndTag” for some reason sitefinity loads it’s own copy of jquery in the middle of the markup and it tends to mess up the rest of the scripts.

    <sf:JavaScriptEmbedControl runat=”server” ID=”jQyeryLink” ScriptEmbedPosition=”BeforeBodyEndTag” Url=”~/scripts/jquery.min.js”></sf:JavaScriptEmbedControl>
    <sf:JavaScriptEmbedControl runat=”server” ID=”JavaScriptEmbedControl1″ ScriptEmbedPosition=”BeforeBodyEndTag” Url=”~/scripts/jquery.cycle.all.js”></sf:JavaScriptEmbedControl>

    The followings are things to note while create a new sitefinity sites.

    Name the solution.
    Open the solution via Sitefinity Project Manager and save the solution in the project folder with proper name

    Set up DB with appropriate name.
    Click “Browse” on the Project Manager to set up the DB.

    Add all references as solution items.
    Copy all reference DLLs from the bin folder of the project to the “Lib” folder. Add them under solution folder items.

    Sitefinity Initial Setup

    Repoint/Rereference the dlls from “Lib” folder
    Remove all sitefinity related references from the project and rereferences them from the “Lib” folder.
    Tip: The easiest way to reference the sitefinity related dlls to the project file would be:
    - open the project file in the notepad
    - search for “bin\”
    - replace the appropriate dll refernces with “..\Lib\”
    DO NOT hit “Replace All” as not all places require replacement.
    All sitefinity related dlls will be rereferenced to correct folder EXCLUDING AjaxControlToolkit and a few others.
    Search for the followings:

    ..\Reference Assemblies\AjaxControlToolkit.dll
    ..\Reference Assemblies\Microsoft\WindowsAzure\Microsoft.WindowsAzure.Diagnostics.dll
    ..\Reference Assemblies\Microsoft\WindowsAzure\Microsoft.WindowsAzure.ServiceRuntime.dll
    ..\Reference Assemblies\Microsoft\WindowsAzure\Microsoft.WindowsAzure.StorageClient.dll

    and repoint to Lib folder as well.
    Note: Everytime you do the upgrade or add a custom dlls, make sure to add/update them in the Lib folder and repoint the project references to Lib.

    Rename the Assembly and DefaultNameSpace with the project name
    Right click on the project > Properties > Application tab > Type in project name in the “Assembly name” and “Default namespace” textboxes.

    Rename Assembly

    Build the solution
    If the aboves are done correctly, your solution will build successfully and once browsed, will display “Thank you for visiting our web site. Please return soon for updates.”
    Else you’ll get the error mentioned in the DON’T section below.


    Don’t use dots “.” in the project name.
    Current version throws error when using dots in the project name.
    Don’t build the solution before repointing the references.
    After creating a new sitefinity site using Sitefinity Project Manager, do not build the project or solution as it will overwrite the dlls from the bin folder and throw the following error.
    _”Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.”_ Ref

    Flickr Photos


    Twitter Status

    Goodie Links

    Mayvelous Friends

    I'm an Author for Global Voices