2012-09-13 41 views
7

當試圖生產服務器我得到這個錯誤上訪問/account/manageMVC 4 SimpleMembership HasLocalAccount方法沒有找到

System.MissingMethodException: Method not found: 'Boolean WebMatrix.WebData.ExtendedMembershipProvider.HasLocalAccount(Int32)'. 
    at Microsoft.Web.WebPages.OAuth.OAuthWebSecurity.HasLocalAccount(Int32 userId) 
    at PROJECT.Controllers.AccountController.Manage(Nullable`1 message) 
    at lambda_method(Closure , ControllerBase , Object[]) 
    at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) 
    at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) 
    at Castle.Proxies.AsyncControllerActionInvokerProxy.InvokeActionMethod_callback(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) 
    at Castle.Proxies.Invocations.ControllerActionInvoker_InvokeActionMethod.InvokeMethodOnTarget() 
    at Castle.DynamicProxy.AbstractInvocation.Proceed() 
    at Glimpse.Mvc3.Interceptor.InvokeActionMethodInterceptor.Intercept(IInvocation invocation) 
    at Castle.DynamicProxy.AbstractInvocation.Proceed() 
    at Castle.Proxies.AsyncControllerActionInvokerProxy.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) 
    at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass42.<BeginInvokeSynchronousActionMethod>b__41() 
    at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) 
    at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End() 
    at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) 
    at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33() 
    at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() 
    at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__36(IAsyncResult asyncResult) 
    at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End() 
    at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) 
    at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<>c__DisplayClass2a.<BeginInvokeAction>b__20() 
    at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) 
    at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End() 
    at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) 
    at System.Web.Mvc.Controller.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) 
    at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) 
    at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End() 
    at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) 
    at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) 
    at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End() 
    at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) 
    at System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) 
    at System.Web.Mvc.MvcHandler.<>c__DisplayClass6.<>c__DisplayClassb.<BeginProcessRequest>b__4(IAsyncResult asyncResult) 
    at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) 
    at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End() 
    at System.Web.Mvc.MvcHandler.<>c__DisplayClasse.<EndProcessRequest>b__d() 
    at System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) 
    at System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) 
    at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) 
    at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) 
    at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) 

它工作正常,從本地主機。谷歌搜索沒有透露。

它還應該指出,我試圖讓這個爆炸「簡單」的成員資格提供商工作在SQL Server上,而不是讓它創建一個數據庫。

p.s.我在共享主機上。

編輯添加了完整的堆棧

+0

對此有任何修復? – CR41G14

+0

這裏同樣的問題。我不在共享主機 - 內部Win2008服務器。 – simon831

回答

5

這個功能做的是查詢webpages_Membership表的唯一的事情。我的工作是複製功能。如果我得到一個真正的答案,我會更新

internal static bool HasLocalAccount(int userId) 
     { 
      using (YOUREntities db = new YOUREntities()) 
      { 
       webpages_Membership wm = db.webpages_Membership.Where(x => x.UserId == userId).FirstOrDefault(); 

       if (wm != null) return true; 
       return false; 
      } 

     } 
+0

有沒有人解決這個問題?我有同樣的問題 – CR41G14

+0

我從來沒有讓它在沒有創建我自己的功能的情況下工作。 – Eonasdan

+0

謝謝 - 這也適用於我。無法理解問題是什麼。 – rwalter

0

Eonasdan發佈的原始函數不適合我。我必須稍微微調一下才能使其工作。如果它可以幫助任何人,這裏是:

@functions{ 
internal static bool HasLocalAccount(int userId){ 
    using (var db = Database.Open("your_database_name")) { 
     dynamic id = db.QueryValue(@"SELECT UserId FROM webpages_Membership WHERE [email protected]", userId); 
     return id != null; // returns true if id is not null 
    } 
} 
} 
0

我也有這個問題。就我而言,這是因爲我的服務器上沒有安裝MVC 4二進制文件。

下SO問題有說明進行安裝:

然後重試帳戶/管理環節 - 它應該工作。

注意要解開你的HasLocalAccount()(如果你在這裏實現了包含在其他答案中的解決方法)。