1

I've just deployed an ASP.NET web site to my hosting provider, but I keep getting the following error when I try and log in:

SQLExpress database file auto-creation error: The connection string specifies a local Sql Server Express instance using a database location within the applications App_Data directory.

I have already set up a DB with the required schema on the host, and I can even log in through the host DB from my dev machine, but not on the hosted site itself. My provider configuration is as follows:

<connectionStrings>
  <add name="Membership" connectionString="data source=localhost;initial catalog=bkelly_aspnetdb;user id=withheld; password=withheld;" />
</connectionStrings>
<system.web>
  <membership defaultProvider="SqlMembershipProvider">
    <providers>
      <clear/>
      <add name="SqlMembershipProvider" 
           type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
           connectionStringName="Membership" 
...

I find nothing at site level that suggests using the App_Data DB, but surely the directive should sort out any machine level provider config?

3
  • Can you post exact connection string you're using ? Jun 20, 2009 at 19:01
  • @s_ruchit, I have updated the connection string somewhat, but if you can show me where people post their exact connection strings on the web, I'll give you some of the money I make. ;-)
    – ProfK
    Jun 20, 2009 at 20:42
  • Are you also using a roleManager, and if so, does it have the right connection string name specified?
    – Jacob
    Jun 20, 2009 at 21:01

3 Answers 3

1

Not 100% on this, but try adding

<clear/>

...before you add your connectionStrings section:

<connectionStrings>
  <clear/>
  <add name="Membership" connectionString="data source=localhost;initial catalog=bkelly_aspnetdb;user id=withheld; password=withheld;" />
</connectionStrings>
0

Might the problem be the disk that the file is on is compressed. This would produce the error you experienced

2
  • @Stuart, what file? I'm trying to connect to a SQL Server database, so the fact that any file is involved is actually the root of my problem.
    – ProfK
    Jun 20, 2009 at 20:39
  • I'm not certain that compression is the problem, just wanted to point you in the direction, so you can investigate. But sql server, the databases contained within are files. For instance in sql express the database file is .mdf, the log file is..ldf
    – Stuart
    Jun 20, 2009 at 21:43
0

Under mono you have to replace the "SqlMembershipProvider" text to something else (doesn't matter unless it's something else) in your config. I don't think your host is using mono, but worth a try.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.