Hi We've tried to add a new user and then assign him to Users Role: DataContext.Current.Session.BeginTransaction();
And during second commit we get a command timeout exception. But the most interesting thing that everything works fine when application is deployed on WindowsServer 2003+IIS6. The problem reproduced only on WindowsServer2008 or Vista + II7. We haven't opened any transaction before this call. A User class is inherited from StdUser. Have someone any ideas? Thanks in advance! |
That is definitely strange. But I think that you can try to resolve the issue via handling all actions in a single transaction. Something like this:
I think this would help because it will eliminate creating implicit transactions during at least accessing Most probably you've run into locking issue and reducing amount of active transactions will reduce such kind of errors probability. |
Hi Alex, Thanks for you quick reaction. But unfortunately I tried to do as you said, and in this case I got error on both environments. Server Error in '/' Application.Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. The statement has been terminated. 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: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. The statement has been terminated. Source Error: Line 296: if (!user.Roles.Contains(DataContext.Current.Session.SystemObjects.UsersRole)) Line 297: { Line 298: user.Roles.Add(DataContext.Current.Session.SystemObjects.UsersRole); Line 299: } Line 300: Source File: E:\Sources\iCandySoftware\Foundation\Com.Dynarics.Foundation\Core\User.cs Line: 298 Stack Trace: [SqlException (0x80131904): Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. The statement has been terminated.] DataObjects.NET.Session.InnerPersistObjects(Key[] keys, Boolean withExternalFields) +2943 DataObjects.NET.Session.Persist() +135 DataObjects.NET.Transaction.Commit() +331 [TransactionAbortedException: Transaction aborted. Inner exception: System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. The statement has been terminated.] DataObjects.NET.Transaction.Commit() +452 DataObjects.NET.Session.Commit() +21 Com.Dynarics.Foundation.Core.User.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean active, Boolean checkEmailDuplicity) in E:\Sources\iCandySoftware\Foundation\Com.Dynarics.Foundation\Core\User.cs:298 BINN.Utilities.Business.CreateUser(String email) in E:\Sources\iCandySoftware\BINN\Utilities\Business.cs:467 BINN.Templates.BINN.Controls.BBPEmployee.CreatePerson() in E:\Sources\iCandySoftware\BINN\Templates\BINN\Controls\BBPDashboard\BBPEmployee.ascx.cs:483 BINN.Templates.BINN.Controls.BBPEmployee.CreateBU(Boolean& isNewBU) in E:\Sources\iCandySoftware\BINN\Templates\BINN\Controls\BBPDashboard\BBPEmployee.ascx.cs:460 BINN.Templates.BINN.Controls.BBPEmployee.Apply_click(Object sender, EventArgs e) in E:\Sources\iCandySoftware\BINN\Templates\BINN\Controls\BBPDashboard\BBPEmployee.ascx.cs:159 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112 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) +5563 Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1 |