Thursday, November 16, 2006

An attempt to attach an auto-named database for file "C:\AAA\database.mdf" failed. A database with the same name exists, or specified file cannot be o

This one of the next headache you have to solve at the time of hosting your application in any web server, and its as follows:

An attempt to attach an auto-named database for file c:\hosting\webhost4life\member\shanti23\aba\LatestABAWebsite\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.

we have to add following few lines to the App.conf file as below:

just refer the link:

alternatively you can rename the database at the time of deploying the web application if any further exception bugged you! hopes this will help you all!

Exception Details: System.Data.SqlClient.SqlException: Failed to update database.

i would like to share my experience with you all because when you started working with SQL Server Express 2005 you have to encounter probelms like one of which am i going to explain you in this blog entry: hopes it will helps you to not to search it for the same problem throughout days or months, as i have to search it for the solution for many days!

Exception Details: System.Data.SqlClient.SqlException: Failed to update database "c:\hosting\webhost4life\member\abc23\aba\LatestABAWebsite\App_Data\aspnetdb.mdf" because the database is read-only.

This will happen mainly coz of the folder permission that we have to apply for the App_data folder: so to rectify this problem you have to follow these steps:

After selecting the 'properties' on the "App_Data" directory,

1. Select the security tab
2. CLick on Add... under "Group or User names:" table
3. On the next window, select Advanced, another window appears and on this, select or rather click on "find now" and a list of Groups and Users should appear on the bottom table.
4. Click on ASPNET followed by OK, and the same on the next 2 windows.

if you need to enable the security tab in Windows XP Professional you have to uncheck the setting for "Use simple file sharing (recommended)" under the View tab in the Folder Options control panel applet to enable the Security tab to be displayed. after that you can be able to view the security tab when you viewed any folder properties.


If you place a file with this name in the root of a web application directory, ASP.NET 2.0 will shuts-down the current web application, unloads the web application from the domain server, and stops processing any new incoming requests for that application.

ASP.NET will also then responds to all requests for dynamic pages in the application by sending back the content of the app_offline.htm file.

For example: you might want to have a “Site is under construction” or “the current website is down for maintenance” or "Uploading Changes" message.

This is one of the convenient & easy way to take down your application while you are making big changes or copying lots of new page functionality (at the same time you can avoid the annoying problem of people hitting and activating your site in the middle of a content update). It can also be a useful way to immediately unlock and unload a SQL Express 2005 database whose .mdf data files are residing in the /app_data directory. This will be applicable for the Access (*.mdb) files too!

Once you have removed the app_offline.htm file from the root, the very next request into the web application will cause ASP.NET to load the application and application domain again, and life will continue along as normal.

Thursday, November 02, 2006



restarted blogging! i was so busy for last few months as i have joined with a new company here in colombo!

hope to see you all soon.