首页 > 解决方案 > Resource file is not working properly on IIS

问题描述

I have 2 resource file.. one is default for english and another one is for chinese. The web app is working fine with VS but when I published it on IIS its not showing chinese language. I tried other solutions available on stackoverflow but nothing seems to work yet. I can find resources.dll inside zh(bin) folder on IIS. Is the error because of there was only one designer file generated that is Resource.designer.cs or something else. I have made the required changes in Resource File properties like making the class public and build action. IN web.config I changed

<globalization enableClientBasedCulture="true" uiCulture="en-US" culture="en-US" />

from false to true. Please ask if Any other information needed to solve this issue. Please give me some advice on this.

标签: c#iisapp-globalresources

解决方案


当我一开始发布它时,App_GlobalResources 没有被复制到服务器上。我能够在服务器上的 bin 文件夹中看到 chiese 的资源 dll,但我认为它没有用。经过一些更改后在我的服务器上重新发布网站,得到了我想要的结果。这是我更改的内容-我转到资源文件的属性并更改了-

构建到 - 内容

复制到输出目录 - 始终复制

自定义工具 - PublicGlobalResourceProxyGenerator(将两个资源文件都公开)

然后在 web.config 我改变了

<globalization enableClientBasedCulture="false" uiCulture="en-US" culture="en-US" />

<globalization enableClientBasedCulture="true" uiCulture="en-US" culture="en-US" />

然后我发布了它并让中文选项正常工作。


推荐阅读