Friday, March 9, 2012

Error 500 Takes it's toll

The Error:

An attempt to attach an auto-named database for file C:\Users\CodeFreak\Documents\Visual Studio 2005\WebSites\PersonalSite\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've tried allowing permissions I'VE EVEN TRIED ALLOWING EVERYONE! I've tried right clicking the datasource under the datasource explorer and clicking 'detatch.' It works Locally but fails when i pusblish with IIS. Whats with these SQL databases that just dont want to work with IIS 7 ?

Published with: IIS 7

I've tried removing the "user instance."

This is User roles and all that which uses SQL Server 2005.

So my question is, How do i publish a website with SQL Server 2005 database?

Please give it to me step by step as im still quite a newbie.

Thanks in advance

Does the Account the Web Service is running with have the appropiate permissions to access the file ? Did you made sure that once the database is opened, the connection is reused at the second time the database is accessed ? Do you have the autoclose property set on or off ?

Jens K. Suessmeyer.

http://www.sqlserver2008.de
|||It was automatically set up, I checked the permissions in both NTFS and the website's permissions they all checked out fine|||

Auto CLose?

Can you elaborate?

I even tried Microsoft's template which failed aswell

I just don't know how to publish a web page after i click and drag a login for and use the administer options to create accounts and set permissions. Remember I'm still a newbie when it comes to aspx, VWD and IIS. I've only used HTML 2 weeks ago (ps. I'm a fast learner). So I would perfer step by step instructions. It works fine during debug but falls over on publish (yes i closed VWD).

|||

Problem solved. It turns out I put it in the same directory as the website.

Moving it (and modifying the connection string accordingly works)

Old connectiong String (From web.config)

data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|datadirectory|aspnetdb.mdf;User Instance=true

Modified Connection String -works (after moving the database files of course)

data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=C:\Mydatabase\aspnetdb.mdf;User Instance=true

Soo easy, I couldn't believe I missed it!

No comments:

Post a Comment