Deploying aspnetdb.mdf to production server

Hi - I am trying to deploy a simple ASP.NET 2.0 application to a server. The application uses the roles and membership features so that I can make use of the builtin Logon controls. This works fine on my development machine. When I try to run it on my server, I manage to get my logon page, but when I try to logon I get the following error message....

<quote>
Server Error in '/wms2' Application.
An attempt to attach an auto-named database for file D:\ftp\wms\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.
</quote>

I have read through other forums discussing this error, but none seem to be relevant. I am not sure where to proceed from here. Do I need to install Visual Studio on my production server, or is there some sort of SQL Server Express registration required with .NET? I installed SQL Server Express after I deployed my app.
trevormastersAsked:
Who is Participating?
 
GranModCommented:
PAQed with points refunded (500)

GranMod
Community Support Moderator
0
 
ptleitchCommented:
you can change the personalization provider to work with your preferred server rather than the built in express that stores the info in your app_data folder as a *.mdf

You should back up your site first because although it is possible to undo what i am about to describe using the same means, i haven't had much luck.

go to start > programs > microsoft visual studio 2005 > visual studio 2005 command prompt

once that opens type aspnet_regsql.exe and press enter

work your way through the wizard to associate the server you want to use with asp.net's personaliztion features like user logins, memberships, and profiles
0
 
trevormastersAuthor Commented:
Will this mean that there will be a single database for both environments? I really need to be able to have two independent databases as the production server is at another site. Sharing a database is not an option.  
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
ptleitchCommented:
I'm sorry but i'm not sure i understand what you mean

by default VS 2005 stores the personalization information in the ASPNETDB.MDF file in the App_Data folder.  if you want it to use your preferred database you can follow the steps above.  You can use sql express or whatever to handle your personalization features.  

what this means is that all of the data your application uses will be in one database instead of the database and the *.mdf file.

If you are having trouble migrating the *.mdf file to a remote server, i recommend following the steps above to tell vs 2005 to use it to handle the personalization options.  when you are ready to move it to production use the wizard again to point it to that server.

Hope this helps
0
 
trevormastersAuthor Commented:
I think it comes down to my lack of understanding of the MDF file and how it is managed/connected. Prior to this, I used an Access database to manage my user accounts and logons. I was expecting the the aspnetdb.mdf file to behave the same way (i.e. just copy it over to the production server and change any relevant connection strings). Am I correct? Or does the MDF file have to SQL Express installed, and you have to somehow tell your app which database to use?

I ran through the wizard (btw, I don't have VS2005 installed in production but aspnet_regsql.exe is in the the .NET Framework directory) and it failed due to permissions so this may be where my initial problem lies.

I will keep at it... I think I just need sleep :)
0
 
trevormastersAuthor Commented:
I got there finally.... but it is a work around for my original problem - not the solution. It appears that I SHOULD just be able to copy the ASPNETDB.MDF (and LDF) files to my app and they will be automatically attached to SQL Express. But it doesn't work.

To work around this, I had to manually attach to the aspnetdb.mdf file using SQL Express Manager. The default database name was set to the pathname on my development PC (NOT the actual path on my server) - anyway, that may be irrelevant. I renamed the database name to "MyDatabase".

In IIS, I went to my virtual directory, and loaded up the ASP.NET configuration properties, and replaced the connection string with the following....
Data Source=.\SQLExpress;Persist Security Info=True;Integrated Security=SSPI;Initial Catalog=MyDatabase

Back to the original problem, is the auto-attach failing because it is looking in the original database path (from my PC), not the new pathname on my server? I.e. it is looking at C:\Documents and Settings\trev\Local Settings....... instead of D:\www\www\App_data\aspnetdb.mdf ?
0
 
ptleitchCommented:
man your still working on this, what dedication, now you can finally get that sleep you spoke of three hours ago
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.