CurrentCulture incorrectly defaulting to en-US in ASP.net

后端 未结 9 1252
执笔经年
执笔经年 2020-12-08 14:37

I have just migrated around 100 ASP.net sites from IIS 6 on Windows Sever 2003 to IIS 7 on Windows 2008. I\'ve just noticed that various pieces of code that use things like

9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-08 14:52

    In my case, my application pool was running as my domain user, which had the current culture set to en-GB, and the application worked fine with en-GB date format.

    I changed the app pool to be run under Network Service instead and suddenly the DateTime.Parse calls were breaking as the app was now using en-US culture. I saw some SO posts (e.g) about how IIS cultures are user-specific which explains that.

    Opening the .NET Globalization of the root element in IIS Manager and setting both Culture and UI Culture to English UK (en-GB) fixed it for me.

提交回复
热议问题