0

I have my own virtual server and I am looking to deploy a website to it.

The problem I am having is setting up the database. Normally on a hosted site I just upload the mdf file and I get a connection string from them.

I tried attaching the mdf file that I created with VS2010 using Management Studio to the 'local' server on my virtual server.

It creates it with a name that is the path to the file 'c:\inetpub\wwwroot...'

How do I get the connection string I need for to use this in my web config file?

I guess I will need to also create a user login for this also?

I did try and just have it use the express connection string but I get this error Unable to open the physical file "C:\inetpub\wwwroot\gtro\App_Data\ASPNETDB.MDF". Operating system error 5: "5(failed to retrieve text for this error. Reason: 15105)". An attempt to attach an auto-named database for file C:\inetpub\wwwroot\gtro\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.

I have changed the app pools in IIS7 to use Network service in Identity.

There is definitely no database already attached with the same name either.

ddd
  • 237
  • 1
  • 2
  • 9

3 Answers3

0

Please create Database on Server. Backup local database and upload .bak file on server. Restore backup using SQL management studio.

if you don't have SQL Express Installed on your VPS. You can download and install it from Microsoft Website.

Please check following URL :

http://forums.iis.net/t/1082433.aspx

maniargaurav
  • 393
  • 1
  • 2
  • 8
  • That never worked. Complains that the backup is from a different database. – ddd Dec 06 '10 at 16:07
  • OK, Have you checked like While restoring database you can give name of database. You can give different name and it will restore it. Please check following URL http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=40841 – maniargaurav Dec 07 '10 at 17:13
0

Since the new database has a different schema, when you restore the database you will need to visit the Options tab and choose Overwrite the existing database.

unhappyCrackers1
  • 977
  • 1
  • 6
  • 18
0

System Error 5 is Access Denied. Are you using SQL 2005 or above? When you create a database and then detach it to attach it to another server its permissions are changed so only the same account can use it. I believe the simple fix is to change the permissions on the local copy of the file to allow admins full control. More info at this blog

edit: blog is now dead.

Hope that helps.

Marlon
  • 136
  • 5