简体   繁体   English

为什么十进制输入验证仅在发布 Razor MVC 应用程序后才显示错误

[英]Why does decimal input validation shows error only after publishing Razor MVC Application

I have issue with decimal input valdation on Razor Page but only after publishing application.我在 Razor 页面上遇到十进制输入验证问题,但仅在发布应用程序之后。 I have changed Default Culture by adding following code in startup:我通过在启动时添加以下代码来更改默认文化:

var supportedCultures=new []
            {
                new CultureInfo("pl-PL"),     
            };
RequestLocalizationOptions locOptions = new RequestLocalizationOptions
{
    DefaultRequestCulture = new Microsoft.AspNetCore.Localization.RequestCulture("pl-PL"),
    SupportedCultures = supportedCultures ,
    SupportedUICultures = supportedCultures,
   
};

app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.MapControllers();
app.UseAuthentication();
app.UseAuthorization();
app.MapRazorPages();
app.UseRequestLocalization(locOptions);

When I launch application via Visual Studio everything works fine - I see decimal separator as comma and insert works fine.当我通过 Visual Studio 启动应用程序时,一切正常 - 我看到小数点分隔符作为逗号并且插入工作正常。 After publishing application using IIS or Azure App Services error shows up only after sending form.使用 IIS 或 Azure 发布应用程序后,应用程序服务错误仅在发送表单后出现。 Error Msg Screen错误消息屏幕

your IIS version is probably different.您的 IIS 版本可能不同。 Do you trying something like this?你在尝试这样的事情吗?

Here Example;这里的例子;

<configuration>
  <system.web>
    <globalization uiCulture="pl" culture="pl-PL" />
  <system.web>
<configuration>

See: How to: Set the Culture and UI Culture for ASP.NET Web Page Globalization请参阅: 如何:为 ASP.NET Web 页面全球化设置文化和 UI 文化

But, I think use should en-US但是,我认为应该使用 en-US

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 发布Silverlight应用程序后出现错误 - Error after publishing Silverlight application 发布MVC5应用程序时出现错误 - Getting error while publishing mvc5 application 为什么我的输入在MVC中返回验证错误异常 - why my input returning validation error exception in MVC 尝试从十六进制转换为十进制和二进制,但如果我在 f 之后输入字母,则会显示错误 - Trying to convert from hexadecimal to decimal and binary but shows an error if i input letter after f mvc razor 在操作后不会重定向到 url - mvc razor does not redirect to url after action 在 IIS 中发布 web 应用程序后出错 - Error after publishing a web application in IIS 使用MVC Razor进行模型验证 - Model Validation With MVC Razor 为什么我的MVC Razor仅在第一次返回视图时才填充HTML表? - Why does my MVC Razor populate the HTML table only the first time the view is returned? ASP.net MVC应用程序中的“指定强制转换无效”错误。 在本地工作,并在发布后一段时间,但然后抛出错误 - 'Specified cast is not valid' error in ASP.net MVC application. Works locally, and for a time after publishing, but then throws the error vs2012中使用C#的Razor MVC验证错误修复 - Razor MVC validation error fix with c# in vs2012
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM