Try our conversational search powered by Generative AI!

When I try to use IIS web server, I get error "startIndex cannot be larger than length of string"

Vote:
 

Dear EPIServer Team,
I have a trouble with using IIS web server, if I use project url http://localhost/Company.Site.WebUI, I have troubles, described bellow in the steps:

1) Create empty EPIServer MVC site Company.Site.WebUI;
get via Nuget
<packages>
  <package id="Castle.Core" version="3.2.0" targetFramework="net40" />
  <package id="Castle.Windsor" version="3.2.0" targetFramework="net40" />
  <package id="EPiServer.CMS.Core" version="7.0.586.16" targetFramework="net40" />
  <package id="EPiServer.Framework" version="7.0.859.16" targetFramework="net40" />
  <package id="Microsoft.AspNet.Web.Optimization" version="1.1.0" targetFramework="net40" />
  <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net40" />
  <package id="Newtonsoft.Json" version="5.0.6" targetFramework="net40" />
  <package id="structuremap" version="2.6.4.1" targetFramework="net40" />
  <package id="WebGrease" version="1.3.0" targetFramework="net40" />
</packages>
2) Go to Project Properties, Web tab, Section "Servers", set "Use Local IIS Web server", project url http://localhost/Company.Site.WebUI
Create Virtual Directory.
Set siteUrl="http://localhost/Company.Site.WebUI/" in siteSettings.
3) Start the site
4) Login to admin
5) See the error page:

-----------------------------------------------------------------------------------
Server Error in '/Company.Site.WebUI' Application.

startIndex cannot be larger than length of string.
Parameter name: startIndex

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: startIndex cannot be larger than length of string.
Parameter name: startIndex

Source Error:

The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

  <%@ Page Language="C#" Debug="true" %>

or:

2) Add the following section to the configuration file of your application:

<configuration>
   <system.web>
       <compilation debug="true"/>
   </system.web>
</configuration>

Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.

Stack Trace:


[ArgumentOutOfRangeException: startIndex cannot be larger than length of string.
Parameter name: startIndex]
   System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy) +14178915
   System.String.Substring(Int32 startIndex) +19
   EPiServer.Framework.Localization.ResourceKeyHandler.ResolveContextBasedKey(String resourceKey) +261
   EPiServer.Framework.Localization.ResourceKeyHandler.NormalizeKey(String resourceKey) +102
   EPiServer.Framework.Localization.LocalizationService.NormalizeKey(String resourceKey) +53
   EPiServer.Framework.Localization.LocalizationService.GetStringByCulture(String resourceKey, String fallback, CultureInfo culture) +101
   EPiServer.UI.WebControls.SystemPrefix.Render(HtmlTextWriter output) +550
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +150
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +249
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +150
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +249
   System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +395
   System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +49
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +111
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +249
   System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +49
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +150
   ASP.episerver_cms_masterpages_episerverui_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in D:\VSProjects\EpiServer\Development\Sources\Company.Site.WebUI\EPiServer\cms\MasterPages\EPiServerUI.Master:10
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +131
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +150
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +249
   System.Web.UI.Page.Render(HtmlTextWriter writer) +40
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +150
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5363

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18045
--------------------------------------------------------------------------------------------------------

Then  
1) Check up all the debugger's settings under [Main Menu] -> Debug -> Exceptions.
2) Start the project via debug
3) Browse and find EPiServerUI.Master
4) Get the error "startIndex cannot be larger than length of string"
5) The toruble is

 

#74363
Aug 26, 2013 12:36
Vote:
 

Could anybody help me?

#74537
Aug 30, 2013 14:37
Vote:
 

I think this is because your virtual directory has dots(.).  I've raised a support case with EPiServer to investigate this.

#75361
Sep 26, 2013 9:40
Vote:
 

Hi, 

This has been registered as bug now. 

Bug #105762: ArgumentOutOfRangeException when application path has dot (.)

 

#75365
Sep 26, 2013 10:36
Vote:
 

Thank you for assistance.

#75366
Sep 26, 2013 10:44
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.