can't view asp.net web form in design view

Topics: Validation Application Block
Sep 1, 2010 at 2:50 PM
Edited Sep 1, 2010 at 6:13 PM

Hi I'm getting the following error on my web form in design view

Error Creating Control - txtRepName

Unable to cast object of type 'Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSyntheticConfigSettings' to type 'Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.ITypeRegistrationsProvider'.

I don't have any EntLib controls on the page.  I am using the Validation Block and I have the validation config in a seperate file that's the only thing I can think of that would be a problem.  It doesn't happen on other screens even when I add all the controls of this one.  

 

Sep 2, 2010 at 7:23 AM

Can you tell us what is the exact line of code that throws this exception? Also, could you post the full exception encountered here. If you can provide a sample project where you're able to encounter this then it's much better to help us with our investigation.

Gino Terrado
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Sep 2, 2010 at 12:24 PM

Actually the code works fine.  But I can't view the form in the designer.  I can only view it in the html source.  This is the entire message that shows in the designer, and it shows for every control. 

Error Creating Control - txtRepName

Unable to cast object of type 'Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSyntheticConfigSettings' to type 'Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.ITypeRegistrationsProvider'.

I think it has something to do with my config file where I'm trying to keep the validation in a seperate file.  Can you send me a link that shows a good example of how this is done?  My code works but maybe I'm doing something not quite right?

 

Sep 3, 2010 at 1:42 AM

Here is the relevant configuration element if you're separating the validation configuration in a separate file:

<validation configSource="validation.config" />

Could you post here your entlib config sections or send it entlib.support@avanade.com?

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Sep 23, 2010 at 7:51 PM

 <configSections>
  <section name="enterpriseLibrary.ConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
 </configSections>

 <enterpriseLibrary.ConfigurationSource selectedSource="System Configuration Source" parentSource="">
  <sources>
   <add name="System Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.SystemConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
   <add name="Validation Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    filePath="C:\SourceCode\ComplaintTracking\Development\Feature - Desktop Optimization\ComplaintTracking\ComplaintTracking.Web\validation.config" />
  </sources>
  <redirectSections>
   <add sourceName="Validation Configuration Source" name="validation" />
  </redirectSections>
 </enterpriseLibrary.ConfigurationSource>

Sep 23, 2010 at 8:08 PM

i've changed my config to something more 'standard' and I still have the problem

 <configSections>
  <section name="validation" type="Microsoft.Practices.EnterpriseLibrary.Validation.Configuration.ValidationSettings, Microsoft.Practices.EnterpriseLibrary.Validation, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
  <section name="enterpriseLibrary.ConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
 </configSections>

 <validation configSource="validation.config">
 </validation>
 
 <enterpriseLibrary.ConfigurationSource selectedSource="System Configuration Source"
  parentSource="">
  <sources>
   <add name="System Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.SystemConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </sources>
 </enterpriseLibrary.ConfigurationSource>

Sep 24, 2010 at 12:45 AM
Edited Sep 24, 2010 at 12:47 AM

I'm not sure if the "Error creating control..." error is caused by entlib configuration.  Could you send us a screenshot of how the error appears like? 

Anyway, what about your databaseSettings configuration?  The error "Unable to cast object of type 'Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSyntheticConfigSettings'... seems more relevant than that of the validation configuration.  Do you also have the section typeregistrationprovidersconfiguration configured? If yes, please post it as well. 

BTW, are you able to open this configuration file using the Enterprise Library Config tool?  Please post the error if there's any.

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Sep 27, 2010 at 1:36 PM

I'm not using EntLib for database settings.  I'm able to open the config file using the Enterprise Library Config tool with no problems.  This only happens when I'm using a Page instead of a UserControl.  I have emailed an image to the email above.

 

Sep 28, 2010 at 1:22 AM

Do you have the typeregistrationprovidersconfiguration section in your web.config?  If yes, could you also post it?

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com