asp.net メンバーシップを MVC4 の新しい simplemembership プロバイダーにアップグレード中です。これは Azure/Sql Azure アプリで、localhost では問題なく動作しますが、展開すると失敗します。次のように、トランザクションにコードがあります。
TransactionOptions toptions = new TransactionOptions();
toptions.IsolationLevel = System.Transactions.IsolationLevel.Serializable;
using (TransactionScope trans = new TransactionScope(TransactionScopeOption.Required, toptions))
{
try
{
... do a bunch of database stuff in a single dbContext ...
var roleprov = (SimpleRoleProvider)Roles.Provider;
string[] roles = roleprov.GetRolesForUser(Username);
// above line fails with The transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D024)
}
}
この手法を使用して Roles クラスを作成しています。スタック トレースは、その呼び出しを完了するために実際にサブトランザクションを起動しようとしていることを示しているようです。simplemembership テーブルは別のデータベースにあります。別のトランザクションのコンテキスト内でロール プロバイダーからロール情報を取得するにはどうすればよいですか?