Turkish locale in MVC .NET
我有一个MVC程序,我目前正在工作,这有点棘手,因为我已经实现了一个土耳其语言资源,但每当我启动网站,它坚持认为有什么问题的观点。当我在数据库中设置自己的区域设置时,我已经让该站点工作。
这个错误似乎已经停止了,但我想知道是否有人可以详细说明为什么.NET似乎接受区域设置"tr"而不是"tr tr"
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | [InvalidOperationException: The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched: ~/Views/register/Index.cshtml ~/Views/register/Index.vbhtml ~/Views/Shared/Index.cshtml ~/Views/Shared/Index.vbhtml] System.Web.Mvc.ViewResult.FindView(ControllerContext context) +356626 System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +121 System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13 System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17() +23 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242 System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +21 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242 System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +21 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +177 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +324 GoRun.Core.Web.HttpMethodActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) in c:\HttpMethodActionInvoker.cs:10 System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__19() +23 System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +19 System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +10 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +57 System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62 System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +47 System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10 System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +25 System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +47 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9657896 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155 |
经过相当长的时间之后,我发现在尝试访问"索引"时(根据土耳其测试,URL路径中的i区分大小写,变得异常敏感)。
http://localhost:54133/demo/register/index(演示/注册/索引)和http://localhost:54133/demo/register/index(演示/注册/索引)将在土耳其地区产生不同的结果…我们最后使用了一个应用程序过滤器,每当调用routePath时,它都应用".toLocalinvariant"。