Problem with adding new URL Configuration > HostName (IHostNameBinding)

Topics: General, Troubleshooting
Sep 20, 2011 at 9:26 PM
Edited Sep 20, 2011 at 9:39 PM

I have been trying to add a new hostname but can't save the entry.

Hostname: mydomain.com

Page: Home (I have three sites on this CMS)

Include Homepage URL: false

Include Language URL: true

Custom 404 page: /error

Alias hostname: blank

Composite C1 2.1.3 (BETA 2). upgraded from 2.1.1

In my server log, I'm getting Critical Errors:

NEWEST to OLDEST:

System.InvalidOperationException: Database already contains a table named Composite_Data_Types_IHostnameBinding_Published   
 at Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Foundation.SqlDataProviderStoreManipulator.CreateStore(DataTypeDescriptor typeDescriptor, DataScopeIdentifier dataScope, CultureInfo cultureInfo)   
at Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Foundation.SqlDataProviderStoreManipulator.CreateStoresForType(DataTypeDescriptor typeDescriptor)   
at Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.SqlDataProvider.CreateStore(DataTypeDescriptor typeDescriptor)   
at Composite.Data.Foundation.PluginFacades.DataProviderPluginFacade.CreateStore(String providerName, DataTypeDescriptor typeDescriptor)   
at Composite.Data.DynamicTypes.DynamicTypeManagerImpl.CreateStore(String providerName, DataTypeDescriptor typeDescriptor, Boolean doFlush)   
at Composite.Data.DynamicTypes.DynamicTypeManager.EnsureCreateStore(Type interfaceType, String providerName)   
at Composite.Data.DataFacadeImpl.AddNew[T](IEnumerable`1 datas, Boolean allowStoreCreation, Boolean suppressEventing, Boolean performForeignKeyIntegrityCheck, Boolean performeValidation, List`1 writeableProviders)   
at Composite.Data.DataFacade.AddNew[T](T collection, Boolean allowStoreCreation, Boolean suppressEventing, Boolean performForeignKeyIntegrityCheck, Boolean performeValidation, List`1 writeableProviders)

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Database already contains a table named Composite_Data_Types_IHostnameBinding_Published   

at Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Foundation.SqlDataProviderStoreManipulator.CreateStore(DataTypeDescriptor typeDescriptor, DataScopeIdentifier dataScope, CultureInfo cultureInfo)   
at Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Foundation.SqlDataProviderStoreManipulator.CreateStoresForType(DataTypeDescriptor typeDescriptor)   
at Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.SqlDataProvider.CreateStore(DataTypeDescriptor typeDescriptor)   
at Composite.Data.Foundation.PluginFacades.DataProviderPluginFacade.CreateStore(String providerName, DataTypeDescriptor typeDescriptor)   
at Composite.Data.DynamicTypes.DynamicTypeManagerImpl.CreateStore(String providerName, DataTypeDescriptor typeDescriptor, Boolean doFlush)   
at Composite.Data.DynamicTypes.DynamicTypeManager.EnsureCreateStore(Type interfaceType, String providerName)   
at Composite.Data.DataFacadeImpl.AddNew[T](IEnumerable`1 datas, Boolean allowStoreCreation, Boolean suppressEventing, Boolean performForeignKeyIntegrityCheck, Boolean performeValidation, List`1 writeableProviders)   
at Composite.Data.DataFacade.AddNew[T](T collection, Boolean allowStoreCreation, Boolean suppressEventing, Boolean performForeignKeyIntegrityCheck, Boolean performeValidation, List`1 writeableProviders)   
--- End of inner exception stack trace ---   
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)   
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)   
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)   
at Composite.Data.DataFacade.AddNew(IData data)   
at Composite.C1Console.Trees.Workflows.GenericAddDataWorkflow.saveCodeActivity_SaveData_ExecuteCode(Object sender, EventArgs e)   
at System.Workflow.ComponentModel.Activity.RaiseEvent(DependencyProperty dependencyEvent, Object sender, EventArgs e)   
at System.Workflow.Activities.CodeActivity.Execute(ActivityExecutionContext executionContext)   
at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(T activity, ActivityExecutionContext executionContext)   
at System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime)   
at System.Workflow.Runtime.Scheduler.Run()


Workflow terminated - Id = 6e8e0317-8e1d-4369-b6ef-1bc02ec29589, Exception:Exception has been thrown by the target of an invocation.   
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)   
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)   
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)   
at Composite.Data.DataFacade.AddNew(IData data)   
at Composite.C1Console.Trees.Workflows.GenericAddDataWorkflow.saveCodeActivity_SaveData_ExecuteCode(Object sender, EventArgs e)   
at System.Workflow.ComponentModel.Activity.RaiseEvent(DependencyProperty dependencyEvent, Object sender, EventArgs e)   
at System.Workflow.Activities.CodeActivity.Execute(ActivityExecutionContext executionContext)   
at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(T activity, ActivityExecutionContext executionContext)   
at System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime)   
at System.Workflow.Runtime.Scheduler.Run()

Steps I have taken:

  1. Rename the IHostNameBinding TABLE in the database

RESULT in Server Log:

SUCCESS:

CREATE TABLE Composite_Data_Types_IHostnameBinding_Published([Id]  [UniqueIdentifier] NOT NULL ,[Hostname]  [NVarChar](255) NOT NULL ,[Culture]  [NVarChar](64) NOT NULL ,[HomePageId]  [UniqueIdentifier] NOT NULL CONSTRAINT DF_Composite_Data_Types_IHostnameBinding_Published_HomePageId DEFAULT N'00000000-0000-0000-0000-000000000000',[PageNotFoundUrl]  [NVarChar](255) NULL ,[Aliases]  [NVarChar](512) NULL ,[IncludeHomePageInUrl]  [Bit] NOT NULL ,[IncludeCultureInUrl]  [Bit] NOT NULL );ALTER TABLE Composite_Data_Types_IHostnameBinding_Published ADD CONSTRAINT PK_Composite_Data_Types_IHostnameBinding_Published PRIMARY KEY CLUSTERED (Id);

FAIL:

Workflow terminated - Id = 7e2991b6-5806-42ad-950a-fc97496dd02b, Exception:Exception has been thrown by the target of an invocation.   at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)   at Composite.Data.DataFacade.AddNew(IData data)   at Composite.C1Console.Trees.Workflows.GenericAddDataWorkflow.saveCodeActivity_SaveData_ExecuteCode(Object sender, EventArgs e)   at System.Workflow.ComponentModel.Activity.RaiseEvent(DependencyProperty dependencyEvent, Object sender, EventArgs e)   at System.Workflow.Activities.CodeActivity.Execute(ActivityExecutionContext executionContext)   at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(T activity, ActivityExecutionContext executionContext)   at System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime)   at System.Workflow.Runtime.Scheduler.Run()

In DATABASE:

New Table NOT CREATED!!

Has anyone got any ideas as to WHAT'S HAPPENING?

Coordinator
Sep 21, 2011 at 11:22 AM

Try editing file /App_Data/Composite/Configuration/DynamicSqlDataProvider.config and removing the following tag

      <add interfaceType="Composite.Data.Types.IHostnameBinding,Composite"
        isGeneratedType="false">
        ....
      </add>

Sep 21, 2011 at 3:29 PM
Edited Sep 21, 2011 at 4:03 PM

Just searched for that entry and it doesn't exist in that config file.

Interestingly, it DOES exist in my dev version of the site, so try add this to interfaces:

 

           <add interfaceType="Composite.Data.Types.IHostnameBinding,Composite"
                isGeneratedType="false">
                <Stores>
                    <add tableName="Composite_Data_Types_IHostnameBinding_Published"
                        dataScope="public" cultureName="" />
                </Stores>
                <DataIdProperties>
                    <add name="Id" type="System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
                </DataIdProperties>
            </add>

And then I get a

SqlDataProvider configuration already contains a interface named 'Composite.Data.Types.IHostnameBinding,Composite'. Remove it from the configuration and restart the application.

ODD...

So I remove it, rename the IHostNameBinding_Published table and now we get the "CREATE TABLE" as a green bar (the table is not created) and back to the:

Workflow terminated - Id = 563ddeb3-a627-490d-9f24-7abe62b8ee81, Exception:
Exception has been thrown by the target of an invocation.
   at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Composite.Data.DataFacade.AddNew(IData data)
   at Composite.C1Console.Trees.Workflows.GenericAddDataWorkflow.saveCodeActivity_SaveData_ExecuteCode(Object sender, EventArgs e)
   at System.Workflow.ComponentModel.Activity.RaiseEvent(DependencyProperty dependencyEvent, Object sender, EventArgs e)
   at System.Workflow.Activities.CodeActivity.Execute(ActivityExecutionContext executionContext)
   at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(T activity, ActivityExecutionContext executionContext)
   at System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime)
   at System.Workflow.Runtime.Scheduler.Run()

Coordinator
Sep 21, 2011 at 6:25 PM

Hard to say what exactly went wrong and where, and if it's something specific to the build you are using.Any way I would try to set the system in to one of the valid states:

1) To put it into state that represents the moment before a type is "registered" in data layer:
a) Delete related SQL table

b) Delete reference in DynamicSqlDataProvider.xml

c) Delete a related xml file in /App_Data/Composite/MetaData folder


after that try to restart the site, and see if it helped


if it didn't, you can try to put it into a state when the table is registered completely .

From you dev site, copy

a) related table

b) related meta data xml file

c) add a reference to DynamicSqlDataProvider.xml

d) restart the site


the second variant has to either work, or produce some meanful warning in the log files

Sep 21, 2011 at 7:22 PM

Well, looks like it worked.

Of note, there was no XML file in the /App_Data/Composite/DataMetaData folder.

One thing I also did is rebuild the assembly cache. Thanks napernik. This helped to understand the underpinnings of how the SQLDataProvider works. I'd be curious to know WHY this worked, though. I'm assuming this resets the data item.