Issue with AddRules

Issue with AddRules

Old forum URL: forums.lhotka.net/forums/t/4852.aspx


sergeyb posted on Thursday, May 15, 2008

Here is a situation.  We have a business rule that compares value entered by the user with a values in lookup table.  The rule itself fires a method to populate name/value list from DB.  SO far so good.  The issue occurs when save is called and data portal method fires.  The AddRules method in business base is called in OnDeserialized, which occurs prior to user being set on context, resulting in "The trust relationship between this workstation and the primary domain failed" exception.  Seems like (from looking at the excpetion trace) the user is still Windows principal at that point, not CSLA custom principal.

Is there a good workaround for this short of dumping the rule?  Or is there a different problem here?

Here is full trace:

Server stack trace:
   at System.Security.Principal.NTAccount.TranslateToSids(IdentityReferenceCollection sourceAccounts, Boolean& someFailed)
   at System.Security.Principal.NTAccount.Translate(IdentityReferenceCollection sourceAccounts, Type targetType, Boolean& someFailed)
   at System.Security.Principal.NTAccount.Translate(IdentityReferenceCollection sourceAccounts, Type targetType, Boolean forceSuccess)
   at System.Security.Principal.WindowsPrincipal.IsInRole(String role)
   at ARCap.Business.Security.CSLARolesBase.CheckRoles(String[] roles) in C:\CenterlineDev\ARCapDEV\SourceCode\ARCap.Business.Security\CSLARolesBase.vb:line 30
   at ARCap.Business.Security.CSLARolesBase.CheckRead() in C:\CenterlineDev\ARCapDEV\SourceCode\ARCap.Business.Security\CSLARolesBase.vb:line 15
   at Centerlink.Business.AssetManagement.PropetyWatchlistTriggerList.CanGetObject() in C:\CenterlineDev\ARCapDEV\SourceCode\Centerlink.Business.Equity.AssetManagement\Lists\PropetyWatchlistTriggerList.vb:line 19
   at Centerlink.Business.AssetManagement.PropetyWatchlistTriggerList.GetPropertyWatchlistTriggerList() in C:\CenterlineDev\ARCapDEV\SourceCode\Centerlink.Business.Equity.AssetManagement\Lists\PropetyWatchlistTriggerList.vb:line 41
   at Centerlink.Business.AssetManagement.PropertyWatchListDetails.AddBusinessRules() in C:\CenterlineDev\ARCapDEV\SourceCode\Centerlink.Business.Equity.AssetManagement\AssetEditor\PropertyWatchListDetails.vb:line 268
   at Csla.Core.BusinessBase.OnDeserializedHandler(StreamingContext context)
   at System.Runtime.Serialization.SerializationEventHandler.Invoke(StreamingContext context)
   at System.Runtime.Serialization.ObjectManager.RaiseDeserializationEvent()
   at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
   at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
   at System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryRequestMessage(String objectUri, Stream inputStream, Boolean bStrictBinding, TypeFilterLevel securityLevel)
   at System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, Stream& responseStream)

Exception rethrown at [0]:
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at Csla.Server.IDataPortalServer.Update(Object obj, DataPortalContext context)
   at Csla.DataPortalClient.RemotingProxy.Update(Object obj, DataPortalContext context)
   at Csla.DataPortal.Update(Object obj)
   at Csla.DataPortal.Update[T](T obj)
   at Csla.BusinessBase`1.Save()
   at Centerlink.Business.AssetManagement.AssetProperty.Save() in C:\CenterlineDev\ARCapDEV\SourceCode\Centerlink.Business.Equity.AssetManagement\AssetEditor\AssetProperty.vb:line 1416

ajj3085 replied on Thursday, May 15, 2008

The only solution to the message "The trust relationship between this workstation and the primary domain failed" is to remove the workstation from the domain and re-add it.   I've heard you may be able to do a Reset Computer Account from the Active Directory Users & Computers, but I haven't had much luck with that.

Copyright (c) Marimer LLC