Login problems after deploying to IIS

Posted on 2006-06-02
Medium Priority
Last Modified: 2007-12-19
I am using VS2005 to build a simple web application. I am using the login control and a SQL Express database to validate the user. The login works fine when I run the web app from VS 2005, but when I deploy the application to IIS the logins fail, and when I try to retrieve the password I get the following error in the browser.

The MDF file is the same one that is in the VS 2005 project. WHat is different when I deploy?

Help please.


Server Error in '/WebSite1' Application.

Failed to update database "C:\INETPUB\WWWROOT\WEBSITE1\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\WEBSITE1\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\WEBSITE1\APP_DATA\ASPNETDB.MDF" because the database is read-only.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +857434
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +735046
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1838
   System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +149
   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +886
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +132
   System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +415
   System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +135
   System.Web.Security.SqlMembershipProvider.ResetPassword(String username, String passwordAnswer) +2226
   System.Web.Security.MembershipUser.ResetPassword(String passwordAnswer) +83
   System.Web.Security.MembershipUser.ResetPassword(String passwordAnswer, Boolean useAnswer, Boolean throwOnError) +34
   System.Web.UI.WebControls.PasswordRecovery.AttemptSendPasswordQuestionView() +352
   System.Web.UI.WebControls.PasswordRecovery.AttemptSendPassword() +66
   System.Web.UI.WebControls.PasswordRecovery.OnBubbleEvent(Object source, EventArgs e) +101
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
   System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +115
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +163
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102


Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
Question by:lachmann
  • 3
  • 2
LVL 25

Expert Comment

ID: 16818767
Try opening IIS and then navigate to the database file.  Right-click the file and choose Properies.
A dialogue box will open.  Under the File tab, check the box that says []Write.
This will give IIS write-permissions.

Author Comment

ID: 16818837
I performed the above actions, and the same thing happens.
LVL 25

Expert Comment

ID: 16818914
If you right-click the file in windows explorer and choose the Security tab (if memory server),  ensure that both IUSR and ASPNET accounts are both listed with write access to the file.

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

LVL 25

Accepted Solution

Rouchie earned 1000 total points
ID: 16818927
There's some more information here http://forums.asp.net/979175/ShowPost.aspx

Expert Comment

ID: 16821619
in your sharing and security of the individual file, add your default web user (normally inet_pub ) to the list of users. Then you can edit the permission of the webuser itself to read / write to the file. This allows for that one file itself to be written to by someone logged to the website hosted from IIS without actually compromising the security of sharing it publicly through the directory.

I assume you are running IIS on a Windows XP or newer server.

Author Comment

ID: 16833720
I am running IIS on Windows XP.

I am still not having any luck with this.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Suggested Courses
Course of the Month17 days, 11 hours left to enroll

831 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