March 28, 2008 at 1:40 pm
I am using MS DTC for my ASP.NET website. I was told that in order to perform MS DTC administration that I had to do so via Component Services in the control panel. I then read that I need to perform the administration via SQL Server Management Studio (I am using SQL Server 2005).
My first question is who is correct. Do I perform the administration via Component Services or Management Studio?
The second question is about how to do so using SQL Server Management Studio (in case that is how it should be done). Using Management Studio I connected to my database, opened up the Management folder and clicked on Distrubuted Transaction Coordinator. The only option that I was given after this was "Refresh". I am at a loss as to what to do next. I can tell you that the MS DTC service seems to be running via Component Services.
What I am missing?
Thanks
March 28, 2008 at 2:20 pm
I would suggest to use the tool it is normaly managed with.
i.e. dcomcnfg
Especialy if you are not familiar with these settings !
Keep in mind these are also security settings !!!
You could also use sqlservers registry-key-XPs to modify the keys.
I actualy configure msdtc in our mixed (w2000 and w2003 sqlserver/oracle/udb/mysql) environment
directly from sqlcmd using :
-- zie HOWTO: Enable DTC Between Web Servers and SQL Servers Running Windows Server 2003
--http://support.microsoft.com/Default.aspx?kbid=555017
set nocount on
-- is xp_cmdshell enabled ? if not, enable it
declare @SQLcmdshell varchar(100)
Create table #tmpConfigCmdShell (configName varchar(128), MinValue varchar(15), MaxValue varchar(15), ConfigValue varchar(15), RunValue varchar(15))
Set @SQLcmdshell = 'sp_configure @configname = ''xp_cmdshell'''
insert into #tmpConfigCmdShell
exec (@SQLcmdshell)
if exists (select * from #tmpConfigCmdShell where configName = 'xp_cmdshell' and RunValue = '0' )
begin
exec sp_configure @configname = 'xp_cmdshell', @configvalue = '1' ;
RECONFIGURE WITH OVERRIDE;
End
declare @DosCmd varchar(500)
Set @DosCmd = 'ver'
SET nocount ON
CREATE TABLE #tmpMsver (line varchar(8000))
insert into #tmpMsver
exec master..xp_cmdshell @DosCmd
if exists (select *
from #tmpMsver
where line like '%Microsoft Windows _Version 5.2%')
begin
-- print @@servername + ' W2k3'
declare @NewSQLArg varchar(50)
declare @NumericValue int
set @NumericValue = 1
create table #tmpRegValues (Value varchar(50), Data varchar(1000))
insert into #tmpRegValues
exec master..xp_instance_regenumvalues N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSDTC'
-- HKEY_LOCAL_MACHINE, then SOFTWARE, then Microsoft.
-- 3. Right-click on MSDTC, point to Add, then select DWORD Value.
-- 4. Rename the key from the default New Value #1 to TurnOffRpcSecurity.
-- 5. Double-click the new key and change the value to 1.
if not exists (select * from #tmpRegValues where Value ='TurnOffRpcSecurity' and Data = '1')
begin
print @@servername + ' Key TurnOffRpcSecurity toevoegen'
--Bepalen volgende SQLArg.
set @NewSQLArg = 'TurnOffRpcSecurity'
--print @NewSQLArg
-- exec xp_instance_regwrite -- N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\MSDTC', @NewSQLArg, N'REG_DWORD', '1'
exec xp_instance_regwrite @rootkey='HKEY_LOCAL_MACHINE',
@key='SOFTWARE\Microsoft\MSDTC',
@value_name='TurnOffRpcSecurity',
@type='REG_DWORD',
@value=@NumericValue
Print 'Allow Distributed transactions' -- (W2K3 rtm)
-- kan ook via DcomCnfg \ Component Services \ Computers \ My computer (rechtsklikken \ Properties \ MSDTC)
exec xp_instance_regwrite @rootkey='HKEY_LOCAL_MACHINE',
@key='SOFTWARE\Microsoft\MSDTC\Security',
@value_name='NetworkDtcAccess',
@type='REG_DWORD',
@value=@NumericValue
exec xp_instance_regwrite @rootkey='HKEY_LOCAL_MACHINE',
@key='SOFTWARE\Microsoft\MSDTC\Security',
@value_name='NetworkDtcAccessAdmin',
@type='REG_DWORD',
@value=@NumericValue
exec xp_instance_regwrite @rootkey='HKEY_LOCAL_MACHINE',
@key='SOFTWARE\Microsoft\MSDTC\Security',
@value_name='NetworkDtcAccessTransactions',
@type='REG_DWORD',
@value=@NumericValue
-- XaTransactions voor DB2 en Oracle communicatie
exec xp_instance_regwrite @rootkey='HKEY_LOCAL_MACHINE',
@key='SOFTWARE\Microsoft\MSDTC\Security',
@value_name='XaTransactions',
@type='REG_DWORD',
@value=@NumericValue
end
else
begin
print @@servername + ' key reeds geïnstalleerd'
select cast(@@servername as char(25)) as ServerNaam, *
from #tmpRegValues
where Value ='TurnOffRpcSecurity'
end
drop table #tmpRegValues
end
else
begin
print @@servername + ' Geen W2k3 - Key niet van toepassing'
end
drop table #tmpMsver
-- did we enable xp_cmdshell ? If yes, disable it
if exists (select * from #tmpConfigCmdShell where configName = 'xp_cmdshell' and RunValue = '0' )
begin
exec sp_configure @configname = 'xp_cmdshell', @configvalue = '0' ;
RECONFIGURE WITH OVERRIDE;
End
drop table #tmpConfigCmdShell
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
March 31, 2008 at 6:23 am
Thanks for getting back to me on this. I do have one more question if you don't mind. I have seen a few examples of using .NET TransactionScope which uses DTC to handle transaction processing. Each of these examples shows that a connection is opened before the first method call and closed after the second method call. I was wondering if you knew if the connection can be closed between calls. In other words given the following code:
1 using (TransactionScope transactionScope = new TransactionScope())
2 {
3 CustomerManager.Insert(customer);
4 AddressManager.Insert(address);
5
6 transactionScope.Complete();
7 }
will I have a problem if each of the insert statements above opens and closes its own connection?
Thanks
March 31, 2008 at 10:34 am
afaik : Yes you will have problems !
They can open in tran-scope, but they can only be closed after the tran-scope has completed.
Reason: MSDTC needs open connections to perform the two phase commits.
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
April 2, 2008 at 12:52 pm
I ran a test and it appears that the DTC works even against closed connections. In the code that follows I have two insert methods that open and close their connection.
using (TransactionScope transactionScope = new TransactionScope())
{
CustomersRowManager.Insert(customersRow);
CustomerAddressRowManager.Insert(CustomerAddresses);
transactionScope.Complete();
}
If the CustomerAddressRowManager.Insert(CustomerAddresses) fails, the CustomersRowManager.Insert is rolled back. If the CustomerAddressRowManager.Insert(CustomerAddresses) succeeds then both the Inserts are committed to the database.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply