Why can't I make remote server (Windows Server 2012) show localized validation messages in my MVC (.NET 4.5) application?

StackOverflow https://stackoverflow.com/questions/22298350

سؤال

I have an MVC application that uses .NET 4.5. I debug it locally and then I publish it to a remote server. The local copy has validation messages in polish, but the remote one has them in english. I've added <globalization culture="pl-PL" uiCulture="pl-PL" /> hoping it will fix the issue, but outside of switching inputs/displays to localized date and float format, nothing changed.

After that I have manually set in IIS' site setting .NET Globalization both Culture and UI Culture to Polish (Poland) (pl-PL) (both of those were set to neutral for some reason) and made sure that Enable Client Based Culture is set to false. That didn't help either (even after restarting the site).

I've seen this problem mentioned a number of times on the internet, but with no working solutions. Nonetheless, one of the threads that I found about the problem suggested that .NET 4.5 is missing the proper language pack. This would seem like an easy problem to fix, yet I have found it impossible to install any language pack on my remote server.

The remote server is running on Windows Server 2012 (seems to be the english version). When I try to install .NET 4.5 language pack I get an error message saying that .NET 4.5 is already installed.

I also found language pack for .NET 4.5.1, but this one also greets me with an error. This time it's a different error though, it says that my system language is incompatible with the language pack's language and I need to either switch my OS to different language or install a language pack. I checked control panel if it is perhaps possible to switch the OS language, but as expected I can't really do that. As for language packs for Windows Server 2012, there is one, but it isn't available for mere mortals. It's only available for members of Microsoft Partner Network program.

Has anyone had the same problem and resolved it or can anyone give me some clues as to what I'm doing wrong here?

هل كانت مفيدة؟

المحلول

Since the fix was preformed by someone else, I cannot describe the exact process, but I'm reposting the general instructions as an answer.

Contrary to what I believed, it appears that it is possible to change the language of Windows Server 2012 in control panel, it's just the option wasn't very obvious to me. Switching this option makes the system do a big patch which might leave you with no .Net runtimes (and possibly other libraries, system tools). Although you might be forced to reinstall those, thankfully you should be able to do so in the language of your choice. When I have time to test it further, I'll post more info as an answer.

For now, if you have a similar problem,

  • Try going to "Control panel"
  • Open "Clock, Language, and Region" section
  • And then the "Language" subsection

Within this section make sure the language, that you want your .Net (and validation messages) to be in, is there.

If it's not, just add it and follow to the next step:

  • Click on the "options" hyperlink(like) button (on the right of your language row)
  • Wait for the "Windows display language" section to load (previously I didn't bother to do so and missed the next option as a result)
  • Pick the "Download and install language pack" option and follow with the installation (it might take a while)

After doing this, it should be possible to install the correct language pack for your .Net.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top