I'm trying to create a user using the SQL membership provider on SQL Express . When I use the TransactionScope
it prompts to DTC with no apparent reason, how can I avoid it?
Here is my example code:
using (var ts = new TransactionScope())
{
MembershipCreateStatus status;
Membership.CreateUser(username, password, null, null, null, true, out status);
var userProfile = ProfileBase.Create(username);
userProfile.SetPropertyValue("Fullname", fullname);
userProfile.Save();
ts.Complete();
}
BTW, I checked in reflector and every membership SQL function always closes its connection.
如建议您可以实现此功能,无需交易在这里 。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.