I’ve got a site used internally inside an Active directory environment.
We’ve got 2 databases _live & _audit
When a user enters data via one of the views, the current record gets cloned to audit via a trigger (with an action tagged to it, Update/Delete & date-time stamp) and the record in the live db gets updated with the new data. Well that’s the plan.
When I run this scenario form my local dev solution and point it to the live db, it works 100%, but on the live site pointed to the live db, on the web-server, I keep getting the following error.
An error occurred while updating the entries. See the inner exception for details.
at System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager stateManager, IEntityAdapter adapter)
at System.Data.Objects.ObjectContext.SaveChanges(SaveOptions options)
at Portal.Repositories.Product_Master_GroupingRepository.Save() in D:\.....:line 125
at Portal.Controllers.Factory.Products.Prod_Info.PLUController.Edit(Int32 id, VM_Product_Master_Grouping viewModel) in D:\.....:line 200
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.\u003c\u003ec__DisplayClass37.\u003c\u003ec__DisplayClass39.\u003cBeginInvokeActionMethodWithFilters\u003eb__33()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.\u003c\u003ec__DisplayClass4f.\u003cInvokeActionMethodFilterAsynchronously\u003eb__49()
A few other observations
- Database interaction from the live site happens via an alias that we created.
- If we disable the trigger the live site saves fine but no logging happens.
- When the trigger is active, the the SQL statement gets generated even if the insert/update “fails”. (But when I copy the statement from SQL profiler and manually run it in SQL, the record gets updated and logged (via the trigger))
- Iv’e got admin right on the network the alias doesn’t (think it might be related to the issue… but not sure)
I can supply some code if it’ll help at all.
As Pawel suggested. Read the exception given. If it says “See the inner exception for details.” go check the inner exception… It’ll def help. (As it turns out my exception logger only logged the main exception message and stack trace, but once i added the inner exception to the live site, i could clearly see the trigger was failing, which confirmed my suspicions that the issue was security related)