Click here to Skip to main content
15,896,330 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I uploaded database directly to App_Data folder then error changed. It started giving some connection error. Anybody please tell me how to work with ASPNETDB.mdf??? 1 thing i dont know database should create on server automatically? or I should upload created mdf file to the server?? This problem has stopped my work for last 3 days.


HI all,

whenever I am running my application i am getting following error. But on my local pc its running well. i dont know how to solve it. Anybody can please help me? The error is like this.. It is creating 1 mdf file in App_Data folder but on server its giving following error.

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. The provider attempted to automatically create the application services database because the provider determined that the database does not exist. The following configuration requirements are necessary to successfully check for existence of the application services database and automatically create the application services database:

If the applications App_Data directory does not already exist, the web server account must have read and write access to the applications directory. This is necessary because the web server account will automatically create the App_Data directory if it does not already exist.
If the applications App_Data directory already exists, the web server account only requires read and write access to the applications App_Data directory. This is necessary because the web server account will attempt to verify that the Sql Server Express database already exists within the applications App_Data directory. Revoking read access on the App_Data directory from the web server account will prevent the provider from correctly determining if the Sql Server Express database already exists. This will cause an error when the provider attempts to create a duplicate of an already existing database. Write access is required because the web server accounts credentials are used when creating the new database.
Sql Server Express must be installed on the machine.
The process identity for the web server account must have a local user profile. See the readme document for details on how to create a local user profile for both machine and domain accounts.

Thanks in advance.
Posted
Updated 16-May-10 21:47pm
v2

Looks like a detailed error message. What have you done to try to fix it, based on the advice it gives ? Does the user on the server have permission to create files ? Is the connection string correct on the server ?
 
Share this answer
 
Comments
hiren soni 16-May-10 8:12am    
There is no problem with connection string or folder permission. Both is OK. But still when its trying to create ASPNETDB.mdf its giving error.
What part of that didn't you understand? It's telling you *exactly* what is required.

0) The web server account needs read/write access to the Applications folder if the App_Data folder doesn't already exist. Solution - create the App_Data folder in your project BEFORE you deploy it.

1) If the App_Data folder DOES exist, but the database file doesn't exist in the App_Data folder, the web server account needs read/write access to the App_Data folder so it can create the database. Solution - create the database in your project BEFORE deploying it.

2) At the very minimum, the web server account needs read access to the App_Data folder so it can detect if the database file exists.

3) Sql Server Express (or higher) must be installed on the web server machine.

4) The web server account must have a local user profile. They even cite the document you should read to create this (if it's not already done).

I'm assuming that items 2, 3 and 4 are not the issue, but given your lack of descriptive prowess regarding your problem, it's really hard to tell.
 
Share this answer
 
Comments
hiren soni 16-May-10 8:10am    
Dear John,
Folder is already created with all the permission. I tried both the way. I also put mdf file before deploying it. But then its giving me connection error. Because by default its taking my local pc's path in connection. And this mdf is automatically generated. So I thought on server also it will create. But its giving error.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900