2

我已经下载了 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使用我在英国的文化。

任何建议都会受到极大的欢迎。

4

1 回答 1

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 表并更新越南语的行;名称=vi,图标=famfamfam-flags vi。

update AbpLanguages set Name='vi', Icon='famfamfam-flags' where Name='vn'
于 2017-08-21T08:06:49.753 回答