23 April, 2013

Errors while updating from EPiServer 7.0 to 7.1

Errors when updating from EPiServer 7.0 to 7.1 in the Add on store


Error #1

You update by using EPiServers built in Add-on system and suddenly the Editmode tab and possibly the Add-on tab disappears.

The problem is that the update removes the old add-ons and then crashes with no rollback because it can't overwrite files in the modules and modulesbin folders in the site.

To repair this, copy the folders Modules and ModulesRepository (usually located in the vpp-folder) from a working site.
Then restart the site.

Now it works, but is still in the old version.

Ensure that the files in modules and modulesbin folders in the site are not write protected and accessible by the system.

Try to update through the add-on tab again.

Error #2

You update by using EPiServers built in Add-on system. The Editmode remains but the content of Edit mode is blank (white)

Try to clear the .net cache
It's usually stored in a folder that looks like this: "c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\"

Restart the site

Error #3

You update by using EPiServers built in Add-on system. And then the site responds with "An item with the same key has already been added."

You probably have the same dll in both the bin and modulesbin folder.
Remove the duplicate from the bin folder (probably EPiServer.Cms.Shell.UI.dll)

25 February, 2013

Cannot find form to submit

I added an XForm to a page in EPiServer 7 using the built in XForms functionality.

When the user submitted the form they got the following error:

Cannot find form to submit (in EPiServer.XForms.WebControls.Submit.SubmitForm)

My stupid mistake was that I accidentally datda bound the xform property on page load...

I had a placeholder around it to control what to display when, and I data bound it without checking for post back... (I know, a newbie misstake ;-) )


 protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            //FormPlaceHolder.DataBind();
            if(!IsPostBack) FormPlaceHolder.DataBind();


Stupid mistake, easy solution :-)

19 November, 2012

Null reference in EPiServer filemanager

You get the following error when trying to open a folder in the EPiServer file manager.


[NullReferenceException: Object reference not set to an instance of an object.]
EPiServer.Web.Hosting.Versioning.VersioningFileSummary..ctor(FileItem file, FileOperations fileOp)

This might happen if the file on disk is removed but the reference to it is still in the EPiServer database. It can also happen if the versioning data has become corrupt for some reason.

I solved it by creating the following simple page/tool:

ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="FixFiles.aspx.cs" Inherits="QD.Web.FixFiles" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Button ID="Button1" OnClick="Button1_Click" runat="server" Text="Deleting files where source don't exist" />
        <asp:Label ID="StartIndexOnItemLit" runat="server" Text="Label"></asp:Label>
    </div>
    </form>
</body>
</html>

Code behind
using System;
using System.Text;
using System.Web.Hosting;
using System.Web.UI;
using EPiServer.Web.Hosting;

namespace QD.Web
{
    public partial class FixFiles : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void Button1_Click(object sender, EventArgs e)

        {
            StartIndexOnItemLit.Text = "";
            var builder = new StringBuilder();
            VirtualPathHandler instance = VirtualPathHandler.Instance;


            foreach (VirtualPathProvider a in VirtualPathHandler.Instance.VirtualPathProviders.Keys)
            {
                if (a is VirtualPathUnifiedProvider)
                {
                    VirtualDirectory dir = instance.GetDirectory((a as VirtualPathUnifiedProvider).VirtualPathRoot, true);

                    foreach (object element in dir.Children)
                    {
                        CheckItem(builder, element);
                    }
                }
            }


            StartIndexOnItemLit.Text = "<ul>" + builder + "</ul>";

        }


        private void CheckItem(StringBuilder builder, object element)

        {
            if (element is UnifiedDirectory)
            {
                CheckDir((element as UnifiedDirectory), builder);
            }

            if (element is UnifiedFile)
            {
                CheckFil((element as UnifiedFile), builder);
            }
        }

        private void CheckDir(UnifiedDirectory dir, StringBuilder builder)
        {
            try
            {
                builder.AppendLine("<ul>");

                foreach (object a in dir.Children)
                {
                    CheckItem(builder, a);
                }

                builder.AppendLine("</ul>");
            }

            catch (Exception error)

            {
                builder.AppendLine(dir.Name + " " + dir.VirtualPath + " " + error.Message + " " + error.StackTrace);
            }
        }

        private void CheckFil(UnifiedFile fil, StringBuilder builder)
        {
            try
            {
                IUnifiedSummary a = fil.Summary;
            }
            catch (Exception error)
            {
                builder.AppendLine("<li>deleting file since source don't exists " + fil.VirtualPath + "</li>");

                fil.Delete();
            }
        }
    }
}


15 November, 2012

Sys.UI is undefined when using Component Art


I had a hard time finding out why i got the "Sys.UI is undefined" error on a page.

After some trouble shooting I found out that the problem was that I use Component Art to render a calendar on my page and the Coponent Art dll was for .net 3 not .net 4 which was the version of my project.

So the solution was to download the new version from Component Art, install it and then reference to the new version in my project.

12 October, 2012

Relate+ or community search - Could not get search results for uri




I had a hard time finding out why the search service in EPiServer community (or relate+) did not return any search results. When investigating the EPiServer log (log4net) I found that the webserver returned 404 (not found) when trying to send the search request to the search service IndexingService.svc.

But it was possible to reach the service by entering its url in a web browser. (I got the "endpoint not found" error which means that I reached the service)

So it seemed crazy that it didn't work. It really should work (heard that before?)

I than analyzed the IIS-logs and found out that the 404 error that was reported in the EPiServer log really was an 404.15 error (Query String Too Long).

So I analyzed what was really sent to the search service, and found out that all groups that the user is a member of was sent in the request. Since we use AD-accounts the users were members of lots of groups and the query string became very long.

I solved it by adding the following to the generic system.webServer section of web.config.


<system.webServer>
    <security>
        <requestFiltering>
            <requestLimits maxQueryString="10000" />
        </requestFiltering>
    </security>
</system.webServer>

Here is the error message I found in the EPiServer log


EPiServer.Search.RequestHandler.GetSearchResults - Could not get search results for uri 'http://{your site}/IndexingService/IndexingService.svc/search/?q=(EPISERVER_SEARCH_DEFAULT%3a(searchword*))+AND+(EPISERVER_SEARCH_ACL%3a(U%5c%3a415aa516%5c-1653%5c-46b0%5c-85c0%5c-2ee3faf5e08d)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aClub+members+1b6bafd0%5c-44c4%5c-4b13%5c-bf29%5c-fe110c7c1110)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aClub+members+21adf78a%5c-aba5%5c-452a%5c-9ebf%5c-c5cd345abc7e)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aClub+members+5ee681c7%5c-f001%5c-4478%5c-a7b3%5c-62e6f6cca6a3)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aClub+members+6ab59e8a%5c-47d6%5c-4d17%5c-aa83%5c-6bc3e0fba1ac)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aClub+members+95ed85c7%5c-8982%5c-4b13%5c-913b%5c-967a10b9edf5)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aClub+members+ac01b6a8%5c-a740%5c-4d69%5c-a523%5c-029133dd41c7)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aClub+members+bc60d25e%5c-f254%5c-43d5%5c-93ef%5c-32527e5f849c)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aClub+members+c2c78b48%5c-bc99%5c-4226%5c-b377%5c-86398f105ed1)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aClub+members+cb229ec7%5c-8d31%5c-4000%5c-807c%5c-491fbc9e34fd)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aClub+members+de2a5931%5c-5c58%5c-4fe6%5c-a183%5c-4f24d9f5dead)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aClub+members+f6b18ceb%5c-eee8%5c-4b1a%5c-9248%5c-9eac2c759d56)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aClub+members+fd39c628%5c-40eb%5c-4599%5c-b972%5c-da9dfda5b7d5)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aClub+members+fd984453%5c-54f0%5c-4daa%5c-aa3d%5c-9e9b6125b387)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aCommunityMembers)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aEveryone)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aAuthenticated+Users)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aNETWORK)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aNTLM+Authentication)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aThis+Organization)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aAG+AgdaEntre)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aAG+Allow+Client+Removable+Drives)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aAG+MailBox_Info)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aAG+Microsoft+Office+2010)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aAG+Microsoft+Outlook+2010)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aAG+Microsoft+Snipping+Tool)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aAG+yourcompanyIntra)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aAG+yourcompanyIntra+Admins)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aAG+yourcompanyIntra+Editors)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aAG+yourcompanyIntra+Upload)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aAG+XenApp+Desktop)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aAG+XenApp+OTP)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aAG_XenApp_VPN)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aDomain+Users)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aG%5c-010)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aG%5c-060)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aG%5c-060%5c-Diego)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aG%5c-080)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aG%5c-130)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aG%5c-130%5c-Projekt+G)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aG%5c-130%5c-Projekt+G%5c-01)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aG%5c-150%5c-GIAB_Info_diverse)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aG%5c-200+SAP%5c-W)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aG%5c-IntranetAdmin)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3ayourcompany+HK)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3ayourcompany+Users)+OR+EPISERVER_SEARCH_ACL%3a(G%5c%3aUsers))&namedindexes=&offset=0&limit=10&format=xml&accesskey=local'. Message: The remote server returned an error: (404) Not Found. at System.Net.HttpWebRequest.GetResponse()


11 October, 2012

This collection already contains an address with scheme http


When using EPiServer Community (relate+) on a site with several configured host header names the search stops working.

When trying to reach the search service through the browser (http://{my site}/IndexingService/IndexingService.svc/) I get the  "This collection already contains an address with scheme http" error

I fixed this issue by adding multipleSiteBindingsEnabled="true" to the serviceHostingEnvironment tag in web.config (it's locatated in the serviceModel tag)

<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" >

02 October, 2012

Check if the page is in editmode in EPiServer 7


The official way to check if the page is in edit mode in EPiServer 7 is:
PageEditing.PageIsInEditMode


Another way might be to check the request parameter:
if (! string.IsNullOrEmpty(Request.Params["epieditmode"]))

      return true;