Reputation: 4100
I am getting a "MSDTC on server 'ADMIN-PC\SQLEXPRESS' is unavailable" error in the following code
Customer class:
public class Customer
{
public int Id;
public string CustomerName;
public string CustomerID;
}
The action from a controller which causes the error in question:
public ActionResult CreateCustomerLogins()
{
List<Customer> customer = new List<Customer>;
customers = c.GetCustomerList(); // returns List<Customer>
try
{
using (TransactionScope scope = new TransactionScope())
{
foreach (Customer item in customers)
{
WebSecurity.CreateUserAndAccount(item.CustomerName, item.CustomerID);
}
scope.Complete();
}
}
catch (TransactionAbortedException tae)
{
ModelState.AddModelError("Error", "Error generating customer logins.");
}
return Json(new { });
}
What's wrong with my code?
Upvotes: 0
Views: 789
Reputation: 5822
SQL Express does not support MSDTC straight off the bat.
see if this helps:
http://www.learningpenguin.net/myblog/2008/03/12/msdtc-on-server-sqlexpress-is-unavailable/
To fully enable MS DTC:
1.In Control Panel, open Administrative Tools, and then double-click Component Services.
2.In the left pane of Console Root, click Component Services, and then expand Computers.
3.Right-click My Computer, and then click Properties.
4.On the MSDTC tab, click Security Configuration.
5.Under Security Settings, select all of the check boxes.
6.Verify that the DTC Logon Account name is set to NT AUTHORITY\NetworkService
Upvotes: 1