The type String cannot be constructed. You must configure the container to supply this value.
Hi,
Keep getting this error. Just downloaded the SDK 2 and tried to run the samples.
As I had modified the C:\Program Files (x86)\Telerik\Sitefinity SDK 4.0\Samples\CS\SitefinityWebApp\App_Data\Sitefinity\Configuration\DataConfig.config to change the connectionstring I thought it had to do with; http://www.sitefinity.com/devnet/forums/sitefinity-4-x/general-discussions/taxonomymanager-error.aspx and I tried all the things mentioned in that thread. But it didn't work.
I even installed SQLExpress and did a reinstall of the SDK, tried to run it again without changing anything and got the same error.
I can work with the samples in a different site so no worries, just thought you guys might want to know.
Regards,
Peter
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.
|
[InvalidOperationException: The type String cannot be constructed. You must configure the container to supply this value.] Telerik.Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.GuardTypeIsNonPrimitive(IBuilderContext context, SelectedConstructor selectedConstructor) +285 Telerik.Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.PreBuildUp(IBuilderContext context) +356 Telerik.Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context) +262 Telerik.Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlanCreatorPolicy.CreatePlan(IBuilderContext context, NamedTypeBuildKey buildKey) +187 Telerik.Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context) +221 Telerik.Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context) +262 Telerik.Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(NamedTypeBuildKey newBuildKey) +232 Telerik.Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(IBuilderContext context) +90 BuildUp_Telerik.Sitefinity.Taxonomies.TaxonomyManager(IBuilderContext ) +192 Telerik.Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(IBuilderContext context) +42 Telerik.Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context) +309 Telerik.Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context) +262 Telerik.Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides) +377 [ResolutionFailedException: Resolution of the dependency failed, type = "Telerik.Sitefinity.Taxonomies.TaxonomyManager", name = "OpenAccessDataProvider". Exception occurred while: while resolving. Exception is: InvalidOperationException - The type String cannot be constructed. You must configure the container to supply this value. ----------------------------------------------- At the time of the exception, the container was: Resolving Telerik.Sitefinity.Taxonomies.TaxonomyManager,OpenAccessDataProvider Resolving parameter "providerName" of constructor Telerik.Sitefinity.Taxonomies.TaxonomyManager(System.String providerName, System.String transactionName) Resolving System.String,(none) ] Telerik.Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides) +440 Telerik.Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, String name, IEnumerable`1 resolverOverrides) +45 Telerik.Microsoft.Practices.Unity.UnityContainer.Resolve(Type t, String name, ResolverOverride[] resolverOverrides) +43 Telerik.Microsoft.Practices.Unity.UnityContainerExtensions.Resolve(IUnityContainer container, String name, ResolverOverride[] overrides) +126 Telerik.Sitefinity.Abstractions.ObjectFactory.Resolve(String name) +109 Telerik.Sitefinity.Data.ManagerBase`1.GetManager(String providerName, String transactionName) +323 Telerik.Sitefinity.Data.ManagerBase`1.GetManager() +72 Telerik.Sitefinity.Taxonomies.TaxonomyManager.GetManager() +27 Telerik.Sitefinity.Modules.DefinitionsHelper.CreateTaxonomyLink(Guid id, String commandName, String commandArgument, WidgetBarSectionElement sidebar) +150 Telerik.Sitefinity.Modules.GenericContent.ContentDefinitions.DefineContentBackendContentView(ConfigElement parent) +9215 Telerik.Sitefinity.Web.UI.ContentUI.Config.ContentViewConfig.OnPropertiesLoaded() +118 Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadSection(ConfigSection section, ConfigPolicyHandler policyHandler, String policyName) +182 Telerik.Sitefinity.Configuration.ConfigSection.Initialize(ConfigProvider provider, ConfigPolicyHandler policyHandler, String policyName, Boolean singlePolicy) +251 Telerik.Sitefinity.Configuration.ConfigSection.Initialize(ConfigProvider provider) +45 Telerik.Sitefinity.Configuration.Config.Get() +206 Telerik.Sitefinity.Modules.News.NewsModule.Initialize(ModuleSettings settings) +82 Telerik.Sitefinity.Services.SystemManager.InitializeModule(ModuleSettings settings, Boolean start) +144 Telerik.Sitefinity.Services.SystemManager.Initialize() +911 Telerik.Sitefinity.Abstractions.Bootstrapper.RegisterRoutes(RouteCollection routes) +1703 Telerik.Sitefinity.Abstractions.Bootstrapper.Bootstrap() +115 Telerik.Sitefinity.Web.SitefinityHttpModule.Init(HttpApplication context) +42 System.Web.Routing.UrlRoutingModule.System.Web.IHttpModule.Init(HttpApplication application) +10 System.Web.HttpApplication.InitModulesCommon() +80 System.Web.HttpApplication.InitModules() +43 System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +828 System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +304 System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +107 System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +327 |
Hi j8,
Thank you for using our services.
The error you are experiencing is most probably caused by the fact that you have tried to connect the website to a blank database. Please note that in Sitefinity 4.0 we keep all configurations in ~/App_Data/Sitefinity/Configuration. When you have tried to connect to the empty database you should also delete the content of the configuration folder in order to be able to initialize the website from scratch.
Can you try to uninstall the SDK and go to the install directory and delete the project. The uninstall does not remove your projects. Then install the SDK and try to run the website as is.
Regards,
Radoslav Georgiev
the Telerik team
Hi,
I just downloaded the SDK 2, opened the sample project, build and run. At that point I got a message indicating I didn't have SQLExpress so I tried to attach the db in SQLServer and change the connectionstring in ~/App_Data/Sitefinity/Configuration/DataConfig.config
(Remember I'm talking about the Sample Project in the SDK directory so it wasn't a blank database.)
After that the "The type String cannot be constructed ..." message appeared.
I have installed SQLExpress now and if I do a fresh install it will work, just wanted to let you know.
Thanks,
Peter
To add to this discussion I am now also getting this error. However I am connected to what was a fully working Site, but now that I am trying to add a Silverlight widget to the mix I now get this error.
I believe it has something related to OpenAccess and a DynamicTypeBase though. The code below causes this error to occur:
Error
Server Error in '/' Application.
--------------------------------------------------------------------------------
ComicWidget.Models.DynamicTypeBase
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.TypeLoadException: ComicWidget.Models.DynamicTypeBase
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:
[TypeLoadException: ComicWidget.Models.DynamicTypeBase]
Telerik.OpenAccess.RT.ClassHelper.MakeClass(String clsName, Type t) +63
Telerik.OpenAccess.RT.ClassHelper.forName(String clsName) +335
OpenAccessRuntime.util.classhelper.dotnet.ClassHelperImpl.classForName(String clazz, Boolean validate, Object loader) +34
OpenAccessRuntime.metadata.MetaDataBuilder.loadClass(String name) +55
OpenAccessRuntime.metadata.MetaDataBuilder.createMetaData(PackageMetaData pmd, DataObjectsClass dataObjectsCls, Boolean quietParam) +1071
[OpenAccessException: The persistence-capable-superclass named 'ComicWidget.Models.DynamicTypeBase' was not found.
--> (Database.Get parameter):mapping-id=mssqlMapping/namespace[ComicWidget.Models]/class[SitefinityComic]]
DynamicModule.ns.Wrapped_OpenAccessTaxonomyProvider_a78f56e10a5b4c5a98372130c2dae469.Initialize(String providerName, NameValueCollection config, Type managerType) +283
Telerik.Sitefinity.Data.ManagerBase`1.InstantiateProvider(DataProviderSettings providerSettings, Type providerType, ExceptionPolicyName policy, ManagerBase`1 manager) +2241
Telerik.Sitefinity.Data.ManagerBase`1.InstantiateProvider(DataProviderSettings providerSettings, ExceptionPolicyName policy, ManagerBase`1 manager) +117
Telerik.Sitefinity.Data.ManagerBase`1.SetProvider(String providerName, String transactionName) +426
Telerik.Sitefinity.Data.ManagerBase`1..ctor(String providerName, String transactionName) +240
Telerik.Sitefinity.Data.ManagerBase`1..ctor() +37
Telerik.Sitefinity.Taxonomies.TaxonomyManager..ctor() +28
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) +98
System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) +241
System.Activator.CreateInstance() +103
Telerik.Sitefinity.Data.ManagerBase`1.GetManager(String providerName, String transactionName) +184
Telerik.Sitefinity.Data.ManagerBase`1.GetManager() +72
Telerik.Sitefinity.Taxonomies.TaxonomyManager.GetManager() +27
Telerik.Sitefinity.Modules.DefinitionsHelper.CreateTaxonomyLink(Guid id, String commandName, String commandArgument, WidgetBarSectionElement sidebar) +150
Telerik.Sitefinity.Modules.GenericContent.ContentDefinitions.DefineContentBackendContentView(ConfigElement parent) +9215
Telerik.Sitefinity.Web.UI.ContentUI.Config.ContentViewConfig.OnPropertiesLoaded() +118
Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadSection(ConfigSection section, ConfigPolicyHandler policyHandler, String policyName) +182
Telerik.Sitefinity.Configuration.ConfigSection.Initialize(ConfigProvider provider, ConfigPolicyHandler policyHandler, String policyName, Boolean singlePolicy) +251
Telerik.Sitefinity.Configuration.ConfigSection.Initialize(ConfigProvider provider) +45
Telerik.Sitefinity.Configuration.Config.Get() +206
Telerik.Sitefinity.Modules.News.NewsModule.Initialize(ModuleSettings settings) +82
Telerik.Sitefinity.Services.SystemManager.InitializeModule(ModuleSettings settings, Boolean start) +144
Telerik.Sitefinity.Services.SystemManager.Initialize() +911
Telerik.Sitefinity.Abstractions.Bootstrapper.RegisterRoutes(RouteCollection routes) +1703
Telerik.Sitefinity.Abstractions.Bootstrapper.Bootstrap() +115
Telerik.Sitefinity.Web.SitefinityHttpModule.Init(HttpApplication context) +42
System.Web.Routing.UrlRoutingModule.System.Web.IHttpModule.Init(HttpApplication application) +10
System.Web.HttpApplication.InitModulesCommon() +80
System.Web.HttpApplication.InitModules() +43
System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +828
System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +304
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +107
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +327
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
using
ComicWidget.Models;
using
System;
using
System.Web;
using
Telerik.Sitefinity;
using
Telerik.Sitefinity.Metadata.Model;
using
Telerik.Sitefinity.Web.UI;
namespace
ComicWidget
public
class
Comic : SimpleView
/// <summary>
/// Initializes the controls part of your template.
/// </summary>
/// <param name="container">Template container for all controls.</param>
/// <remarks>
/// Initialize your controls in this method. Do not override CreateChildControls method.
/// </remarks>
protected
override
void
InitializeControls(GenericContainer container)
CreateComicMetaTable();
protected
override
string
LayoutTemplateName
get
return
"ComicWidget.Resources.Views.ComicTemplate.ascx"
;
private
string
GetAuthorityUrl()
var authority =
this
.Page.Request.Url.GetLeftPart(UriPartial.Authority);
return
VirtualPathUtility.RemoveTrailingSlash(authority);
private
void
CreateComicMetaTable()
App.WorkWith()
.DynamicData()
.Type()
.CreateNew(
"SitefinityComic"
,
"ComicWidget.Models"
)
.Do(dt => dt.DatabaseInheritance = DatabaseInheritanceType.horizontal)
.Field()
.CreateNew(
"Description"
,
typeof
(
string
))
.Done()
.Field()
.CreateNew(
"URL"
,
typeof
(
string
))
.Done()
.Field()
.CreateNew(
"ImageExtension"
,
typeof
(
string
))
.Done()
.Field()
.CreateNew(
"Prefix"
,
typeof
(
string
))
.Done()
.Field()
.CreateNew(
"PublishedDay"
,
typeof
(
string
))
.Done()
.Field()
.CreateNew(
"Name"
,
typeof
(
string
))
.Done()
.SaveChanges(
true
);
/// <summary>
/// Ensures that the Comic model has the required metafields.
/// </summary>
/// <param name="restart">if set to <c>true</c> [restart].</param>
private
void
EnsureMetaFields(
ref
bool
restart)
bool
changedDB =
false
;
App.WorkWith().DynamicData().Type(
typeof
(SitefinityComic))
.Field().TryCreateNew(
"Description"
,
typeof
(
string
),
ref
changedDB).Done()
.Field().TryCreateNew(
"URL"
,
typeof
(
string
),
ref
changedDB).Done()
.Field().TryCreateNew(
"ImageExtension"
,
typeof
(
string
),
ref
changedDB).Done()
.Field().TryCreateNew(
"Prefix"
,
typeof
(
string
),
ref
changedDB).Done()
.Field().TryCreateNew(
"PublishedDay"
,
typeof
(
string
),
ref
changedDB).Done()
.Field().TryCreateNew(
"Name"
,
typeof
(
string
),
ref
changedDB).SaveChanges(
true
);
if
(changedDB)
restart = changedDB;
//private void CreateDefaultData()
//
// using (var fluent = App.WorkWith())
//
// //fluent.DynamicData()
//
//
Hello Garry Clark,
Can you please try to explain a little bit the code in your SimpleView control? What I am failing to understand is why you are creating new Dynamic types every time the control is initialized. The problem you are experiencing is that you have created a dynamic type which uses a name space which is different than Telerik.Sitefinity.DynamicTypes.Model. Currently dynamic types can only belong to this name space. To fix the problem you will have to open your database table sf_meta_types and either change the name space for the row with class name SitefinityComic or delete the row.
Right now the Dynamic Types API is still in progress and it would be really helpfull if you could explain what you need to do so that we can provide some guidance.
Kind regards,
Radoslav Georgiev
the Telerik team
Hello Admin,
I have Created my Website in Sitefinity 4.1.1395 ... When im running my website im getting error as The type String cannot be constructed. You must configure the container to supply this value.
I have attached screenshots ... Please tel me the Solution ...
Thanks & regards
Anu.
Hello Anu,
it seems that the screenchots did not go through. Can you try sending them again? Also please let us know what have been the latest changes to the project, before you started experiencing the error.
Regards,
Radoslav Georgiev
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>