Recently I happened to work with System.Transactions namespace and SQL 2000.
I have noticed that if we use TransactionScope, then with SQL 2000 the transaction is automatically enlisted in the MSDTC even if we are using single data base.The code works fine if we deply the SQL 2000 on Win2K server, because MSDTC automatically be started if the code runs. Problem comes only when MSDTC is disabled on this Win2k machine.
This is the exception that occurs:
System.Transactions.TransactionAbortedException: The transaction has aborted. ---> System.Transactions.TransactionManagerCommunicationException: Communication with the underlying transaction manager has failed. ---> System.Runtime.InteropServices.COMException (0x8004D01B): Exception from HRESULT: 0x8004D01B at System.Transactions.Oletx.IDtcProxyShimFactory.ConnectToProxy(String nodeName, Guid resourceManagerIdentifier, IntPtr managedIdentifier, Boolean& nodeNameMatches, UInt32& whereaboutsSize, CoTaskMemHandle& whereaboutsBuffer, IResourceManagerShim& resourceManagerShim) at System.Transactions.Oletx.DtcTransactionManager.Initialize() ---
The above problem occurs if we deploy the SQL 2000 on win2k3 server, because by default all security settings are disabled on the MSDTC on Win2K3. So in order to make it work, we need to configure MSDTC on the Win2k3 server to accept remote requests and other stuff.
Go to Control panel -> Adminstrative Services -> Component Services
Component Services -> Computers -> My Computer
go to properties of MyComputer, select MSDTC TAB
click on 'Security Configuration'
Make sure you check "Network DTC Access", "Allow Remote Client","Allow Inbound/Outbound", "Enable TIP"
Now the code should run fine. Else try after restaring the machine.
Note:
This behavior is different if we use SQL 2005 as SQL 2005 promotes the transaction to use MSDTC only when it's required.
Tuesday, March 30, 2010
Issues with reading Output, Return values from Stored Procedure
The sequence is important when we try to read output/return values from stored procedures using ADO.NET. This article is specific to ExecuteReader and retrieving outparam/return values..
Output or ReturnValues from the storedprocedure cannot be retrieved from the command object unless we completely traverse through the Reader.
for more info check: http://support.microsoft.com/?id=308051
Thanks,
-Krish...
Output or ReturnValues from the storedprocedure cannot be retrieved from the command object unless we completely traverse through the Reader.
for more info check: http://support.microsoft.com/?id=308051
Thanks,
-Krish...
Create .EML or .MSG files programmatically using C#.
In this article I will try to document my experiences about creating the .eml and .msg files using C#.
Problem statement:
The requirement is to send emails to out side world with attachments. The email can contain more than one email as attachment and those attachments should look like as new email message is actually being attached to the outgoing email.
Possible soultions identified:
1. As we need to have email as attachment, so having other kinds of attachments ruled out.
2. Possible option for the email attachments are either .eml or .msg.
.MSG file can be created using Microsoft.Interop.xxx assembly and attach to the email and remember .msg is a Microsoft propriatory standard.
Courtesy : For more information: http://weblogs.asp.net/darrensim/archive/2008/06/29/creating-an-outlook-message-file-with-c.aspx
.eml is the global standard. But how can we create .eml file? This can be done by digging through the System.Net.mail.MailMessage.Send() method.
A very good article is available in codeproject : http://www.codeproject.com/kb/ip/smtpclientext.aspx?msg=2876295
Problem statement:
The requirement is to send emails to out side world with attachments. The email can contain more than one email as attachment and those attachments should look like as new email message is actually being attached to the outgoing email.
Possible soultions identified:
1. As we need to have email as attachment, so having other kinds of attachments ruled out.
2. Possible option for the email attachments are either .eml or .msg.
.MSG file can be created using Microsoft.Interop.xxx assembly and attach to the email and remember .msg is a Microsoft propriatory standard.
Courtesy : For more information: http://weblogs.asp.net/darrensim/archive/2008/06/29/creating-an-outlook-message-file-with-c.aspx
.eml is the global standard. But how can we create .eml file? This can be done by digging through the System.Net.mail.MailMessage.Send() method.
A very good article is available in codeproject : http://www.codeproject.com/kb/ip/smtpclientext.aspx?msg=2876295
Subscribe to:
Posts (Atom)