Microsoft.Practices.EnterpriseLibrary.Data.Common repository method CreateDatabase(conneciton string) throwing exception.


  • 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.


    • Moved by John Saunders Sunday, September 18, 2011 5:36 AM off-topic (From:ASMX Web Services and XML Serialization)
    Saturday, September 10, 2011 6:39 AM

All replies

  • I don't know where you should have asked this question, but this is the wrong forum for it.


    John Saunders
    WCF is Web Services. They are not two separate things.
    Use WCF for All New Web Service Development, instead of legacy ASMX or obsolete WSE
    Use File->New Project to create Web Service Projects
    Monday, September 12, 2011 2:00 AM
  • Are you using Windows Authintication  for connecting to SQL server from  if so check Integrated Auth mode =true in IIS.

    Lingaraj Mishra
    Tuesday, September 13, 2011 12:53 PM
  • Hi Sorry for delayed reply.. Yes it is already set to true.


    Now I have got a new problem.


    I was able to succeede in solving the issue mentioned here but I have got a new problem.


    I hosted my web application on Windows server IIS7. My SQL server data base also resides on the same server. When I browse the application from the same server the application works fine and connects to the data base properly.

    But when I try to access the application from another machine with other windows domain credentials the application doesn't connect to the database and throws exception "Login Failed for User"  :(.


    Could you please help me in solving this issue.




    Sunday, September 18, 2011 5:33 AM
  • Hello Dears,


    I revisited all the ROLES AND permissions for Network service and gave appropriate permissions (eg: dbOwner) and this gave me the answer to all my questions. I was able to connect to the database and run my application correctly :)


    Thanks All for your answers...




    Wednesday, September 28, 2011 5:04 AM