Skip to content

Episerver: Out of Memory Exception for Geta SEO Sitemaps on IISExpress

About Geta SEO Sitemaps Plugin:
The Geta SEO sitemaps on episerver (CMS & Commerce)is a tool that is used to generate xml
sitemaps for search engines. The geta SEO sitemaps plugin can be installed as NuGet Package in visual
studio. The sitemaps generation is performed automatically by a regularly scheduled job. When configuring settings for a new
sitemap the format column has multiple options such as:

  • Standard
  • Commerce
  • Mobile
  • Standard and Commerce

For a commerce website, to generate a single sitemap for standard content along with products &
categories, the Standard and Commerce format is selected for the sitemap. Separate sitemaps for
standard content & commerce data can be generated by creating two different setting for each. To
generate sitemap for the created sitemap settings, run the scheduled job “Generate search engine
sitemaps”.

Problem (Out Of Memory Exception):
When the scheduled job is executed for the any of the above settings locally and if you have a lot of content or commerce items, the job runs for a while but eventually fails to generate sitemaps because of a Out of memory exception.

Episerver log
System.OutOfMemoryException: Exception of type ‘System.OutOfMemoryException’ was thrown.
at System.Uri.CheckForUnicode(String data)
at System.Uri.InitializeUri(ParsingError err, UriKind uriKind, UriFormatException& e)
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at System.Uri..ctor(String uriString, UriKind uriKind)
at EPiServer.Web.Routing.Internal.VirtualPathHostResolver.ResolveTargetSite(RequestContext requestContext, RouteValueDictionary values)
at EPiServer.Web.Routing.Internal.VirtualPathHostResolver.GetVirtualPathHost(RequestContext requestContext, RouteValueDictionary values, Boolean& currentSite)
at EPiServer.Web.Routing.Segments.Internal.LanguageSegment.GetVirtualPathSegment(RequestContext requestContext, RouteValueDictionary values)
at EPiServer.Web.Routing.Segments.SegmentBase.GetVirtualPathSegment(RequestContext requestContext, RouteValueDictionary values, HashSet`1 usedValues)
at EPiServer.Web.Routing.Internal.DefaultContentRoute.AddVirtualPathFromSegments(StringBuilder virtualPath, RequestContext requestContext, RouteValueDictionary values, HashSet`1 usedValues, Int32 lastNonDefaultIndex)
at EPiServer.Web.Routing.Internal.DefaultContentRoute.GetVirtualPath(RequestContext requestContext, RouteValueDictionary values)
at EPiServer.Web.Routing.Internal.DefaultUrlResolver.GetUrlFromRoute(ContentReference contentReference, String language, RouteValueDictionary routeValues, RequestContext requestContext)

Solution:
The memory consumption when the scheduled job is executed is more than the limit set to 32 bit IIS express (1 GB). Using the 64 bit IIS will allow use of more than 1 GB memory.

The the 64 bit mode can be enabled (for visual studio 2015) by navigating to the below path after entering in to registry editor.
*(Replace 14.0 with the visual studio version installed, 12.0 for 2013 etc.)

OR
You can enable it using the following command as a local Administrator.

reg add HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\WebProjects /v Use64BitIISExpress /t REG_DWORD /d 1