Dieses Blog durchsuchen

Dienstag, 25. Februar 2014

Sitecore: Field property is required. All field web controls require the field name to be set.

Server Error in '/' Application.

Field property is required. All field web controls require the field name to be set.

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.InvalidOperationException: Field property is required. All field web controls require the field name to be set.

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:


[InvalidOperationException: Field property is required. All field web controls require the field name to be set.]
   Sitecore.Web.UI.WebControls.FieldControl.DoRender(HtmlTextWriter output) +538
   Sitecore.Web.UI.WebControl.Render(HtmlTextWriter output) +378
   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.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +150
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +249
   System.Web.UI.WebControls.WebControl.RenderContents(HtmlTextWriter writer) +15
   System.Web.UI.WebControls.ListView.Render(HtmlTextWriter writer) +18
   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
   Sitecore.Web.UI.WebControls.Sublayout.DoRender(HtmlTextWriter output) +43
....





SOLUTION:

1. My recommendation is to use the Fieldrender if possible. There are many types supported, even Images.
See the list of supported types here:
http://www.theinsidecorner.com/en/Developers/ContentDisplay/FieldValues/UsingFieldRenderer

2. If you use the sc:Text control, be careful with the Attribute for the Field Name!! They look different and are not equal. Sadly the "Enclosing Tag" or the"CssClass" Attribute are not available in important SC Controls. That makes life harder and need to set via code behind or with just HTML.   

Use Attribute "Field" for the sc:Text Control to set the Fieldname from the Sitecore Backend!
<sc:Text ID="scText" Field="Description" runat="server" />


Mittwoch, 19. Februar 2014

Sitecore: Sitecore.Data.Database. No matching constructor was found.

I had this error in a deployment package for the CD = Content Delivery Server.

Server Error in '/' Application.


Could not create instance of type: Sitecore.Data.Database. No matching constructor was found.

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: Sitecore.Exceptions.ConfigurationException: Could not create instance of type: Sitecore.Data.Database. No matching constructor was found.

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:


[ConfigurationException: Could not create instance of type: Sitecore.Data.Database. 

No matching constructor was found.]
   Sitecore.Configuration.Factory.CreateFromTypeName(XmlNode configNode, 
String[] parameters, Boolean assert) +394
   Sitecore.Configuration.Factory.CreateObject(XmlNode configNode, 
   Sitecore.Configuration.Factory.CreateObject(String configPath, String[] 
parameters, Boolean assert) +420
   Sitecore.Configuration.Factory.GetDatabase(String name, Boolean assert) +185
   Sitecore.Configuration.Factory.GetDatabases() +168
   Sitecore.Data.Managers.HistoryManager.InitializeEventHandlers() +49
   Sitecore.Pipelines.Loader.InitializeManagers.Process(PipelineArgs args) +16
   (Object , Object[] ) +80
   Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +365
   Sitecore.Nexus.Web.HttpModule.Application_Start() +175
   Sitecore.Nexus.Web.HttpModule.Init(HttpApplication app) +516
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, 
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, 
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance
(IntPtr appContext, HttpContext context) +404
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475

[HttpException (0x80004005): Could not create instance of type: Sitecore.Data.Database. 
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12968244
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate
(IIS7WorkerRequest wr, HttpContext context) +12807949



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



Solution Info:

One thing we were sure that this is something to do with master DB only. So, we started looking at config file’s under App_Config folder and here’s our HERO — Sitecore.Buckets.config:
1
2
3
4
5
6
7
8
9
10
11
12
13
<databases>
      <database id="master" singleInstance="true" type="Sitecore.Data.Database, Sitecore.Kernel">
        <Engines.DataEngine.Commands.AddFromTemplatePrototype>
          <obj type="Sitecore.Buckets.Commands.AddFromTemplateCommand, Sitecore.Buckets" />
        </Engines.DataEngine.Commands.AddFromTemplatePrototype>
      </database>
      <database id="web" singleInstance="true" type="Sitecore.Data.Database, Sitecore.Kernel">
        <Engines.DataEngine.Commands.AddFromTemplatePrototype>
          <obj type="Sitecore.Buckets.Commands.AddFromTemplateCommand, Sitecore.Buckets" />
        </Engines.DataEngine.Commands.AddFromTemplatePrototype>
      </database>
    </databases>
    <events>
So, we commented out master DB’s Configuration and here’s how it looks like:
1
2
3
4
5
6
7
8
9
10
11
12
<databases>
<!--<database id="master" singleInstance="true" type="Sitecore.Data.Database, Sitecore.Kernel">
<Engines.DataEngine.Commands.AddFromTemplatePrototype>
<obj type="Sitecore.Buckets.Commands.AddFromTemplateCommand, Sitecore.Buckets" />
</Engines.DataEngine.Commands.AddFromTemplatePrototype>
</database>-->
<database id="web" singleInstance="true" type="Sitecore.Data.Database, Sitecore.Kernel">
<Engines.DataEngine.Commands.AddFromTemplatePrototype>
<obj type="Sitecore.Buckets.Commands.AddFromTemplateCommand, Sitecore.Buckets" />
</Engines.DataEngine.Commands.AddFromTemplatePrototype>
</database>
</databases>
And Yes, It resolved our error,