MarimerLLC / cslaforum

Discussion forum for CSLA .NET
https://cslanet.com
Other
31 stars 6 forks source link

Issue with EnterpriseServices setup for TransactionScope in CSLA .Net #511

Open FASTER-NileshkumarPatel opened 6 years ago

FASTER-NileshkumarPatel commented 6 years ago

When I try to use EnterpriseServices as a models for Transaction, I’m getting the following error:

Additional information: DataPortal.Update failed (System.EnterpriseServices.RegistrationException: Failed to register assembly 'Csla, Version=4.3.13.0, Culture=neutral, PublicKeyToken=93be5fdc093e4c30'. ---> System.UnauthorizedAccessException: Access to the registry key 'HKEY_CLASSES_ROOT\Csla.Server.ServicedDataPortal' is denied. at Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str) at Microsoft.Win32.RegistryKey.CreateSubKeyInternal(String subkey, RegistryKeyPermissionCheck permissionCheck, Object registrySecurityObj, RegistryOptions registryOptions) at Microsoft.Win32.RegistryKey.CreateSubKey(String subkey, RegistryKeyPermissionCheck permissionCheck) at Microsoft.Win32.RegistryKey.CreateSubKey(String subkey) at System.Runtime.InteropServices.RegistrationServices.RegisterManagedType(Type type, String strAsmName, String strAsmVersion, String strAsmCodeBase, String strRuntimeVersion) at System.Runtime.InteropServices.RegistrationServices.RegisterAssembly(Assembly assembly, AssemblyRegistrationFlags flags) at System.EnterpriseServices.RegistrationDriver.ClassicRegistration(Assembly asm) --- End of inner exception stack trace --- at System.EnterpriseServices.RegistrationDriver.ClassicRegistration(Assembly asm) at System.EnterpriseServices.RegistrationDriver.InstallAssembly(RegistrationConfig regConfig, Object obSync))

Following is the stack trace: at System.EnterpriseServices.RegistrationDriver.ClassicRegistration(Assembly asm) at System.EnterpriseServices.RegistrationDriver.InstallAssembly(RegistrationConfig regConfig, Object obSync)

NOTE: CSLA Version: 4.3.13.0 The TransactionScope model of Transactions is working fine in our application.

We are having scenarios where a two-phase distributed transaction is required so I want to use Enterprise Library Transactions. Any help to fix this problem would be appreciated.

rockfordlhotka commented 6 years ago

It has been many years since I had to work with COM+, so my memory is a little vague.

But I believe you have to go into the COM+ admin console and register your COM+ types before they can be used. You can't just run them and get auto-registration. There's some registration and configuration that's required.

CSLA tries to mitigate this a little, because what you do is host the data portal in COM+, and then it loads your specific business types into an existing transactional context. In other words, the only component you should need to register with COM+ is the Enterprise Services data portal itself.

You do also need to make sure the Microsoft DTC is configured and running on your server, and that it has access to your databases. Again, I don't remember the specifics, but as I recall the DTC isn't configured by default on Windows Server, so you do have to turn it on.