現在、私はホストプロバイダDiscountASPでASP.Net MVC4に組み込まれたデフォルトメンバーシップサービスを使用してユーザーを登録するか、エラーを受け取るこのメソッドを呼び出すには、 "Membership.Provider"プロパティが "ExtendedMembershipProvider"のインスタンスである必要があります
To call this method, the "Membership.Provider" property must be an instance of "ExtendedMembershipProvider".
これはローカルでは発生しません。ここで
は私InitializeSimpleMembershipAttribute.cs
次のとおりです。ここで
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public sealed class InitializeSimpleMembershipAttribute : ActionFilterAttribute
{
private static SimpleMembershipInitializer _initializer;
private static object _initializerLock = new object();
private static bool _isInitialized;
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
// Ensure ASP.NET Simple Membership is initialized only once per app start
LazyInitializer.EnsureInitialized(ref _initializer, ref _isInitialized, ref _initializerLock);
}
private abstract class SimpleMembershipInitializer
{
protected SimpleMembershipInitializer()
{
Database.SetInitializer<UsersContext>(null);
try
{
using (var context = new UsersContext())
{
if (!context.Database.Exists())
{
// Create the SimpleMembership database without Entity Framework migration schema
((IObjectContextAdapter)context).ObjectContext.CreateDatabase();
}
}
WebSecurity.InitializeDatabaseConnection("DefaultConnection", "UserProfile", "UserId", "UserName", autoCreateTables: true);
}
catch (Exception ex)
{
throw new InvalidOperationException("The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588", ex);
}
}
}
}
は、エラーのスクリーンショットです:
私はこれを修正したり、それを扱う記事を知ることができますどのように誰もが知っていますか?
の下でログイン機能を変更しようと、あなたは、web.configファイルの ''部分を表示することができますか? SimpleMembershipを使用しようとしているようですが、プロバイダが一致していないようです。また、 'WebMatrix。*'が参照のプロパティの下で 'Copy Local = True'に設定されていることを確認してください。 –
私は実際に何らかの理由でWeb.configでメンバーシップセクションを定義していません。どのように見えるか教えていただけますか? –