Link to home
Start Free TrialLog in
Avatar of lachmann
lachmann

asked on

Login problems after deploying to IIS

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
Avatar of Rouchie
Rouchie
Flag of United Kingdom of Great Britain and Northern Ireland image

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.
Avatar of lachmann
lachmann

ASKER

I performed the above actions, and the same thing happens.
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.
ASKER CERTIFIED SOLUTION
Avatar of Rouchie
Rouchie
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
I am running IIS on Windows XP.

I am still not having any luck with this.