Click here to Skip to main content
12,396,461 members (33,842 online)
Rate this:
Please Sign up or sign in to vote.
finally after hard work , i designed and developed a website and it is working fine on my local server .

i have 2 databases ,one of them is the main database which i create it with sql server 2005 ,
the other one called [ aspnetdb.mdf ] which was implemented internally with VS2008
and it just for membership .

Now after i upload a website on a server using FTP , the website working fine but when i browse a page that using [aspnetdb.mdf] data base , the below Error appeared

An attempt to attach an auto-named database for file D:\ftp\folder 1 \Domain name \www\App_Data\aspnetdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

my web.config contain the connection string of the first DB only
how i solve this problem .
i try to google this topic but i reach nothing , kindly help me

Posted 15-Jul-12 12:19pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Do not use the aspnetdb.mdf on the hosting server. You can generate the Membership tables inside your main database using the aspnet_regsql command line utility.[^]
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

ASPNETDB.mdf should not be used as membership database on production server.

You should configure your production database to handle the membership data. run aspnet_regsql command on visual studio command prompt and configure the required database.

Secondly,(If you still want to use this only) by default the ASPNETDB.mdf is being accessed using the windows authentication when we access it on development machines. when you put your code on production server this will not work because windows authentication must be disables and sqlserver authetication must be used. you can do that by changing theweb.config
file, specifically the ConnectionString of the database.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 16 Jul 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100