2017-08-18 89 views
2

我已經下載了ASP.NET Boilerplate的啓動模板。Asp.Net Boilerplate啓動模板 - 文化問題

已成功按照說明創建和種子數據庫。

當我來到運行應用程序,我出現以下錯誤:

Server Error in '/' Application. 

Culture is not supported. 
Parameter name: name 
vn is an invalid culture identifier. 

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Globalization.CultureNotFoundException: Culture is not supported. 
Parameter name: name 
vn is an invalid culture identifier. 

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace: 


[CultureNotFoundException: Culture is not supported. 
Parameter name: name 
vn is an invalid culture identifier.] 
    System.Globalization.CultureInfo..ctor(String name, Boolean useUserOverride) +192 
    Abp.Localization.<>c.<Get>b__3_0(String n) +29 
    System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +62 
    Abp.Localization.CultureInfoHelper.Get(String name) +144 
    Abp.Localization.MultiTenantLocalizationDictionaryProvider.CreateLocalizationDictionary(LanguageInfo language) +61 
    Abp.Localization.<>c__DisplayClass11_0.<GetDictionaries>b__0(String s) +18 
    System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +62 
    Abp.Localization.MultiTenantLocalizationDictionaryProvider.GetDictionaries() +161 
    Abp.Localization.MultiTenantLocalizationDictionaryProvider.get_Dictionaries() +10 
    Abp.Localization.Dictionaries.DictionaryBasedLocalizationSource.GetStringOrNull(String name, CultureInfo culture, Boolean tryDefaults) +42 
    Abp.Localization.Dictionaries.DictionaryBasedLocalizationSource.GetString(String name) +38 
    Abp.Authorization.<AuthorizeAsync>d__19.MoveNext() +513 
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92 
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58 
    Abp.Authorization.<CheckPermissions>d__22.MoveNext() +255 
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92 
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58 
    Abp.Authorization.<AuthorizeAsync>d__20.MoveNext() +297 
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92 
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58 
    Nito.AsyncEx.<>c__DisplayClass15_0.<Run>b__0(Task t) +80 
    System.Threading.Tasks.ContinuationTaskFromTask.InnerInvoke() +52 
    System.Threading.Tasks.Task.Execute() +49 
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92 
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58 
    Nito.AsyncEx.AsyncContext.Run(Func`1 action) +201 
    Abp.Authorization.AuthorizationHelperExtensions.Authorize(IAuthorizationHelper authorizationHelper, MethodInfo methodInfo, Type type) +82 
    Abp.Web.Mvc.Authorization.AbpMvcAuthorizeFilter.OnAuthorization(AuthorizationContext filterContext) +197 
    System.Web.Mvc.ControllerActionInvoker.InvokeAuthorizationFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor) +97 
    System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__19(AsyncCallback asyncCallback, Object asyncState) +743 
    System.Web.Mvc.Async.WrappedAsyncResult`1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +14 
    System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +128 
    System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeAction(ControllerContext controllerContext, String actionName, AsyncCallback callback, Object state) +343 
    System.Web.Mvc.Controller.<BeginExecuteCore>b__1c(AsyncCallback asyncCallback, Object asyncState, ExecuteCoreState innerState) +25 
    System.Web.Mvc.Async.WrappedAsyncVoid`1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +30 
    System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +128 
    System.Web.Mvc.Controller.BeginExecuteCore(AsyncCallback callback, Object state) +465 
    System.Web.Mvc.Controller.<BeginExecute>b__14(AsyncCallback asyncCallback, Object callbackState, Controller controller) +18 
    System.Web.Mvc.Async.WrappedAsyncVoid`1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +20 
    System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +128 
    System.Web.Mvc.Controller.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +374 
    System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +16 
    System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__4(AsyncCallback asyncCallback, Object asyncState, ProcessRequestState innerState) +52 
    System.Web.Mvc.Async.WrappedAsyncVoid`1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +30 
    System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +128 
    System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +384 
    System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +48 
    System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +16 
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +103 
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155 

至於我能察覺,該vn文化標識是越南但是我無法確定如何會產生錯誤,並且我可以做些什麼來確保en文化因我在英國的使用而被使用。

任何意見將大大收到。

+0

數據庫似乎是設置爲'en'文化不過這顯然是被忽略了,但我想不通的地方...... – weblar83

回答

3

打開DefaultLanguagesCreator類並使用以下方法更改構造方法;

static DefaultLanguagesCreator() 
     { 
      InitialLanguages = new List<ApplicationLanguage> 
      { 
       new ApplicationLanguage(null, "en", "English", "famfamfam-flags gb"), 
       new ApplicationLanguage(null, "tr", "Türkçe", "famfamfam-flags tr"), 
       new ApplicationLanguage(null, "zh-CN", "簡體中文", "famfamfam-flags cn"), 
       new ApplicationLanguage(null, "pt-BR", "Português-BR", "famfamfam-flags br"), 
       new ApplicationLanguage(null, "es", "Español", "famfamfam-flags es"), 
       new ApplicationLanguage(null, "fr", "Français", "famfamfam-flags fr"), 
       new ApplicationLanguage(null, "it", "Italiano", "famfamfam-flags it"), 
       new ApplicationLanguage(null, "ja", "日本語", "famfamfam-flags jp"), 
       new ApplicationLanguage(null, "nl-NL", "Nederlands", "famfamfam-flags nl"), 
       new ApplicationLanguage(null, "lt", "Lietuvos", "famfamfam-flags lt"), 
       new ApplicationLanguage(null, "vi", "Vietnamese", "famfamfam-flags vi") 
      }; 
     } 

https://github.com/aspnetboilerplate/module-zero-template/blob/master/src/AbpCompanyName.AbpProjectName.EntityFramework/Migrations/SeedData/DefaultLanguagesCreator.cs

另外,你需要更新你的數據庫,因爲種子的方法不會更新現有的語言。打開AbpLanguages表並更新 Vietnamese的行; Name = vi,Icon = famfamfam-flags vi。

update AbpLanguages set Name='vi', Icon='famfamfam-flags' where Name='vn' 
+0

謝謝,已經固定,你是惠康的問題 – weblar83

+0

。 –