none
Microsoft.Enterpriselibrary.common.DataAccess Repository CreateDatabase(string connectionstring) throwing exception. RRS feed

  • Question

  • Hi,

    I have the following issue. Quick help required..

    1) I have a web application to be hosted on IIS. When I run the application in the debug mode locally the application connects to the Database and it all works fine. But when I try to host it on IIS server and then try to access the application it is hosted but not connecting to the Data Base. I tried to find out the root cause and found that the CreateDatabase(string DatabaseConnectionString) is throwing an exception in the repository of the Dataaccess block.

    Here is the exception message.

    "The value can not be null or string or empty.\r\nParameter name: id"

    Following is the stack trace :

      at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory.BuildUp[T](IReadWriteLocator locator, ILifetimeContainer lifetimeContainer, String id, IConfigurationSource configurationSource)
       at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory.BuildUp[T](String id, IConfigurationSource configurationSource)
       at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.NameTypeFactoryBase`1.Create(String name)
       at Microsoft.Practices.EnterpriseLibrary.Data.DatabaseFactory.CreateDatabase(String name)
       at DERAS.Common.DataAccess.Repository`1..ctor(String databaseName) in D:\DERAS.Common\DataAccess\Repository.cs:line 29

     

    Please provide a solution for this problem as I need to host my application and make it connect to the the DB as soon as possible

     

    Thank You.

    Farhan

     

    Saturday, September 10, 2011 5:43 AM

All replies

  • Seems like you are passing a null or empty string where some name or id should be.
    Paulo Morgado
    Saturday, September 10, 2011 2:05 PM
  • Hi Paulo,

     

    When the application is hosted on IIS. i DONT KNOW WHY there is a null/empty value passed to CreateDatabase method. When I run the code locally there is no problem and my code works and application works connecting to the Database.

    I think there will be some issue in Microsoft.practices.EnterpriseLibrary.Data DatabaseFactory, Can you tell me what configurations needs to be set up in the webconfig in order to use enterprise libraries as I think this is a problem with the configurations in the web config file for IIS hosting.

     

    Thanks

    Farhan

    Sunday, September 11, 2011 4:42 AM
  • You'll probably get better help on the Enterprise Library forums.
    Paulo Morgado
    Sunday, September 11, 2011 9:34 PM