MVC3 upgrade to MVC4 model validation information displayed as English problem and solution

Source: Internet
Author: User

Recently upgrading the project from MVC3 to Mvc4, the deployment to the server has a small problem, that is, in the form of field validation, the validation display information in English, as follows:

The field average rent must be a number

And in the local is good, can display the Chinese information:

Field average rent must be a number

Description: We did not install the MVC component on the server, just introduced the required DLL. The. net4.0 Simplified Chinese Language pack is also installed. The previous MVC3 project was also normal and was upgraded to MVC4 before this problem occurred.

Baidu, Google is just a few messages, no answer. Of course, the solution is not no, it is to install MVC4 required components on the server. However, multiple projects are running on the server, and if you install some programs, a restart is bound to affect other projects that are working on the business, all temporarily ignoring this approach.

After a careful analysis of the problem, I was upgrading from MVC3 to Mvc4, in the middle of just replacing some MVC-related DLL references and configuration file version number, then I create a new real MVC4 project deployed to the service to see whether this problem occurs.

the answer is to display the Chinese authentication information normally. So where does the problem go? We all know one server. If you do not have an MVC component installed, you only need to reference those DLLs. and verification only need to open in the configuration, and then the page to refer to the two JS can be. So, the problem must be in this few places. So through the comparison, found that the new Mvc4 Project bin directory more folders, such as Zh-hans,zh-hant, as programmers to zh-always familiar with things, Baidu, Zh-hans representative of Chinese Simplified, zh-hant representative of Chinese Traditional. Then copy this folder to the project, verify that the information is displayed correctly in Chinese (of course, you can also delete the DLL in Zh-hans).

At this point, the problem has been solved, but I found something that I look familiar with. The DLLs in the Zh-hans folder are provided with resources. Yes, that is, "resources" reminds me of the Chinese and English versions I have done, and that is not to add resource files.

We use Ilspy to decompile, we can see that this is not the resource file we have just guessed, but also can see our verification information above.

At this point, all the answers have been solved.

MVC3 upgrade to MVC4 model validation information displayed as English problem and solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.