[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Cannot connect to database on windows 2003 server

Posted on 2009-04-30
5
Medium Priority
?
790 Views
Last Modified: 2012-05-06
am setting up a server to run my site.  I am running on Wndows 2003 and have SQL Server Express 2008 installed.  I am running the web site on IIS.  I am getting an error when I try to access the database when I try to "register a user":  Also, I changed the database to not be read only, but I am still gettng the error.  I cannot change the folder APP_DATA from being read only (it is a grey mark) but that should not matter since the mdf file can be read.

The error and stack trace are:

Failed to update database "C:\INETPUB\WWWROOT\TEST\APP_DATA\ASPNETDB.MDF" because the database is read-only.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Failed to update database "C:\INETPUB\WWWROOT\TEST\APP_DATA\ASPNETDB.MDF" because the database is read-only.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace:


[SqlException (0x80131904): Failed to update database "C:\INETPUB\WWWROOT\SIGH\APP_DATA\ASPNETDB.MDF" because the database is read-only.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1950890
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4846875
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392
   System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +204
   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +954
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
   System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +175
   System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +137
   System.Web.Security.SqlMembershipProvider.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status) +2430
   System.Web.UI.WebControls.CreateUserWizard.AttemptCreateUser() +318
   System.Web.UI.WebControls.CreateUserWizard.OnNextButtonClick(WizardNavigationEventArgs e) +102
   System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source, EventArgs e) +418
   System.Web.UI.WebControls.CreateUserWizard.OnBubbleEvent(Object source, EventArgs e) +161
   System.Web.UI.WebControls.WizardChildTable.OnBubbleEvent(Object source, EventArgs args) +19
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
   System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +118
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +166
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565

 

0
Comment
Question by:wizkid2332
5 Comments
 
LVL 57

Expert Comment

by:Raja Jegan R
ID: 24277000
0
 
LVL 9

Expert Comment

by:Sander Stad
ID: 24277006
Have you tried to rightclick the database, select "Properties", go to "Options", go to the section "State" and set the "Database Read-Only" to "False"

0
 

Author Comment

by:wizkid2332
ID: 24277069
sstad, I am now getting the error:

The database 'C:\INETPUB\WWWROOT\TEST\APP_DATA\ASPNETDB.MDF' cannot be opened because it is version 655. This server supports version 612 and earlier. A downgrade path is not supported.
Cannot open user default database. Login failed.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.
0
 
LVL 13

Expert Comment

by:St3veMax
ID: 24277189
What version of SQL Server and specifically revision created that database? Could you upgrade your 2nd instance of SQL2008 to the same version; this should resolve that issue.

HTH
0
 
LVL 9

Accepted Solution

by:
Sander Stad earned 750 total points
ID: 24277197
That's because you've upgraded the database to 2008 and your server doesn't support it. Maybe this article help:
http://conceptdev.blogspot.com/2009/04/mdf-cannot-be-opened-because-it-is.html

You can also try to set the compatibility level to 2005 in the Options of the database. Rightclick the database and select "properties". In "Options" set the "Compatibility level" on SQL 2005
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A phishing scam that claims a recipient’s credit card details have been “suspended” is the latest trend in spoof emails.
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question