+1-888-365-2779
Try Now
More in this section

Forums / Deployment / Getting exception when running Sitefinity application in Azure Cloud services

Getting exception when running Sitefinity application in Azure Cloud services

5 posts, 0 answered
  1. Mani
    Mani avatar
    2 posts
    Registered:
    19 Jun 2014
    09 Apr 2015
    Link to this post

    Hi

    I deployed a Sitefinity 7.3 application to Azure Cloud Services using Azure SDK 2.2 version. The application is successfully deployed and the web role instance is in running status. When I ran the application I am getting the following exception

    Please help in resolving this error.

     

    Server Error in '/' Application.

    Unable to cast object of type 'System.String' to type 'System.Type'.

    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.InvalidCastException: Unable to cast object of type 'System.String' to type 'System.Type'.

    Source Error:

    An unhandled exception was generated during the execution of the current
    web request. Information regarding the origin and location of the
    exception can be identified using the exception stack trace below.

    Stack Trace:

    [InvalidCastException: Unable to cast object of type 'System.String' to type 'System.Type'.]
    Telerik.Sitefinity.Configuration.ConfigElement.GetValueFromString(String stringValue, ConfigProperty property) +86
    Telerik.Sitefinity.Configuration.ConfigElementDictionary`2.GetElementByKey(String key) +110
    Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadCollectionElement(ConfigElementCollection collection, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, UpgradingInfo upgradingInfo) +931
    Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadElement(ConfigElement element, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, UpgradingInfo upgradingInfo, Boolean isNew, Boolean validateTagName) +323
    Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadPropertyElement(ConfigElement element, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, UpgradingInfo upgradingInfo) +545
    Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadElement(ConfigElement element, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, UpgradingInfo upgradingInfo, Boolean isNew, Boolean validateTagName) +355
    Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadSectionFromReader(ConfigSection section, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, Boolean checkForUpgrade, UpgradingInfo& upgradingInfo) +439
    Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadSectionFromFile(ConfigSection section, ConfigPolicyHandler policyHandler, String policyName, Boolean withUpgrade) +137
    Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadSection(ConfigSection section, ConfigPolicyHandler policyHandler, String policyName) +82
    Telerik.Sitefinity.Configuration.ConfigSection.Initialize(ConfigProvider provider, ConfigPolicyHandler policyHandler, String policyName, Boolean singlePolicy) +315
    Telerik.Sitefinity.Configuration.ConfigSection.Initialize(ConfigProvider provider) +30
    Telerik.Sitefinity.Configuration.Config.GetSectionInternal(Type sectionType, Boolean safeMode, String sectionName) +541
    Telerik.Sitefinity.Configuration.Config.GetSectionPrivate(Boolean safeMode) +291
    Telerik.Sitefinity.Web.UI.ControlUtilities..cctor() +18

    [TypeInitializationException: The type initializer for 'Telerik.Sitefinity.Web.UI.ControlUtilities' threw an exception.]
    Telerik.Sitefinity.Abstractions.VirtualPath.Configuration.VirtualPathSettingsConfig.OnPropertiesInitialized() +60
    Telerik.Sitefinity.Configuration.ConfigSection.InitializeProperties() +27
    Telerik.Sitefinity.Configuration.ConfigElement.EnsurePropertiesInitialized() +130
    Telerik.Sitefinity.Configuration.ConfigElement.get_Properties() +21
    Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadPropertyElement(ConfigElement element, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, UpgradingInfo upgradingInfo) +49
    Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadElement(ConfigElement element, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, UpgradingInfo upgradingInfo, Boolean isNew, Boolean validateTagName) +355
    Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadSectionFromReader(ConfigSection section, XmlReader reader, ConfigPolicyHandler policyHandler, String policyName, Boolean checkForUpgrade, UpgradingInfo& upgradingInfo) +439
    Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadSectionFromFile(ConfigSection section, ConfigPolicyHandler policyHandler, String policyName, Boolean withUpgrade) +137
    Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadSection(ConfigSection section, ConfigPolicyHandler policyHandler, String policyName) +82
    Telerik.Sitefinity.Configuration.ConfigSection.Initialize(ConfigProvider provider, ConfigPolicyHandler policyHandler, String policyName, Boolean singlePolicy) +315
    Telerik.Sitefinity.Configuration.ConfigSection.Initialize(ConfigProvider provider) +30
    Telerik.Sitefinity.Configuration.Config.GetSectionInternal(Type sectionType, Boolean safeMode, String sectionName) +541
    Telerik.Sitefinity.Configuration.Config.GetSectionPrivate(Boolean safeMode) +291
    Telerik.Sitefinity.Abstractions.VirtualPath.VirtualPathManager.Initialize() +243
    Telerik.Sitefinity.Abstractions.VirtualPath.VirtualPathManager.FileExists(String virtualPath) +98
    System.Web.WebPages.BuildManagerWrapper.IsNonUpdatablePrecompiledApp() +106
    System.Web.WebPages.BuildManagerWrapper..ctor(VirtualPathProvider vpp, IVirtualPathUtility virtualPathUtility) +48
    System.Web.WebPages.VirtualPathFactoryManager.<.cctor>b__6() +56
    System.Lazy`1.CreateValue() +14276560
    System.Lazy`1.LazyInitValue() +476
    System.Web.WebPages.ApplicationStartPage.ExecuteStartPage(HttpApplication application) +167
    System.Web.WebPages.WebPageHttpModule.StartApplication(HttpApplication application, Action`1 executeStartPage, EventHandler applicationStart) +119
    System.Web.WebPages.WebPageHttpModule.InitApplication(HttpApplication application) +75
    System.Web.WebPages.WebPageHttpModule.Init(HttpApplication application) +292
    System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +530
    System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +304
    System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +404
    System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475

    [HttpException (0x80004005): The type initializer for 'Telerik.Sitefinity.Web.UI.ControlUtilities' threw an exception.]
    System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12979380
    System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
    System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12818973

    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34212

    Thanks

    Mani


  2. Sabrie Nedzhip
    Sabrie Nedzhip avatar
    534 posts
    Registered:
    09 Dec 2016
    14 Apr 2015
    Link to this post
    Hi Mani,

    Judging by the error message you are getting it seems that Sitefinity is trying to read the configurations from the file system. Can you please check if you are storing the configuration files in the database?

    In order to check if the configurations are moved to the database, please open your web.config file and then check if the following lines are not commented:

    <sectionGroup name="telerik">
      <section name="sitefinity" type="Telerik.Sitefinity.Configuration.SectionHandler, Telerik.Sitefinity" requirePermission="false" />
    </sectionGroup>



    <telerik>
        <sitefinity>
          <environment platform="WindowsAzure"/>
          <sitefinityConfig storageMode="Database" />
        </sitefinity>
      </telerik>

    You may refer to the following article for more details on this.

    Please make sure that the above lines are not commented out, in order to make sure that Sitefinity gets the configuration files from the database and not from the file system.

    Regards,
    Sabrie Nedzhip
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  3. Zepp
    Zepp avatar
    22 posts
    Registered:
    19 Aug 2015
    13 Oct 2015
    Link to this post

    I am facing a similar problem. Only difference is I have received a Sitefinity project from a client. This project was being developed by someone else. He may have deployed it on Azure. I have not. I just deployed it on Local IIS 7+ with DB on MSSqlServer2012(local). When I try to run the site I see the same error. The snippet you have mentioned in the web.config were commented out already. And because I have not deployed it on Azure, I think they should remain that way. What to do in this case. I don't know whether the settings should be fetched from file system or db. I only have a DB and a Sitefinity Project. The web.config contains commented sections of windows azure. When I run the application I get the same error as : "Unable to cast object of type 'System.String' to type 'System.Type' ..." .

    I tried uncommenting the config sections as described in this post(even though I have not deployed the app on Azure, Its just deployed on local IIS & Local MSSqlServer2012), When I uncommented the config file and ran the application, I get this error: "Could not load file or assembly 'msshrtmi, Version=2.6.0.0, Culture=neutral, PublicKeyToken=xxxxxxxx' or one of its dependencies. The system cannot find the file specified."

     

    What is the solution here. In my scenario I just want to run the application, We don't have direct access to the previous developer. How can I make my application run considering my constraints.

     

  4. Mani
    Mani avatar
    2 posts
    Registered:
    19 Jun 2014
    13 Oct 2015 in reply to Zepp
    Link to this post

    Hi Zepp

    The web.config section has to be commented because you are not deploying to Azure. 

    Are you using visual studio to manage your sitefinity project? If yes which version?

     

    Thanks

    Mani

     

  5. Zepp
    Zepp avatar
    22 posts
    Registered:
    19 Aug 2015
    13 Oct 2015 in reply to Mani
    Link to this post

    Mani, 

    In my case the config sections were already commented out. With commented sections I get this error : "Unable to cast object of type 'System.String' to type 'System.Type'"

     Also note that my DataConfig contains this section: 
    <databaseMappingOptions>
    <azureOptions useMsSqlIdentifierLimitations="False" />
    </databaseMappingOptions>

    I am using Visual Studio 2013 to build and run the project. Complete details regarding my scenario are defined in this thread:

    http://www.sitefinity.com/developer-network/forums/deployment--/having-issues-building-running-a-sitefinity-project

     

     

     

     

     

5 posts, 0 answered