Visual Studio社区2022-服务器错误与app_globalresourceslang.resources

发布于 2025-01-31 19:09:16 字数 1967 浏览 2 评论 0原文

我们在Visual Studio Community 2022中创建了一个多语言C#.NET WebForm网站。

当安装了Visual Studio的计算机中浏览网站时,一切都很好。但是,当网站在没有Visual Studio的计算机中浏览时,会有一个错误:

“/dev/dev/websiteName”应用程序中的服务器错误。堆栈跟踪:

[MISS MANFESTRESOURCEEXEXPEPTION:找不到任何资源 适用于指定文化或中性文化。制作 确保正确的“ projectName.app_globalresources.lang.resources”正确 在编译时嵌入或链接到汇编“ projectName”或 所有所需的卫星组件都是可加载的 签名。] system.Resources.ManifestBasedResourceGroveler.HandlerEsourSourceStreamMissing(String 文件名)+441 system.Resources.ManifestBasedResourceGroveler.GroverForreSourceset(cultureinfo 文化,词典`2 localresourcesets,布尔tryparents,布尔值 CreateIfnotexists,StackCrawlmark& stackmark)+1219 system.Resources.ResourceManager.internalgetResourceset(cultureinfo 请求文化,布尔createifnotexists,布尔tryparents, StackCrawlmark& stackmark)+1008 system.Resources.ResourceManager.internalgetResourceset(cultureinfo 请求文化,布尔createifnotexists,布尔tryparents, StackCrawlmark& stackmark)+1008 system.Resources.ResourceManager.internalgetResourceset(cultureinfo 文化,布尔createifnotexists,布尔tryparents)+43 system.Resources.ResourceManager.getString(字符串名称,culturinfo 文化)+567 projectName.filename.funcationName()in C:\ users \ path \ filename.aspx.cs:80 system.web.ui.control.onload(EventArgs E)+108 system.web.ui.control.loadRecursive()+90 system.web.ui.page.processrequestmain(布尔值 includeSbeforeasyncpoint,boolean includeftages f.terAsyncpoint) +1533版本信息:Microsoft .NET框架版本:4.0.30319; ASP.NET版本:4.8.4330.0

该功能导致错误根据所选语言显示文本的错误。 在该函数中,脚本为:

Thread.CurrentThread.CurrentCulture = new CultureInfo(Session["Lang"].ToString());
rm = new ResourceManager("ProjectName.App_GlobalResources.Lang", Assembly.GetExecutingAssembly());
ci = Thread.CurrentThread.CurrentCulture;

Resx文件的属性是:

  1. 构建操作:嵌入式资源
  2. 自定义工具:GlobalResourCeproxygenerator
  3. 副本到输出目录:不要复制

我们尝试

  1. 将设置更改为:复制:如果新的
  2. 使用新的Resx文件, 请复制 但仍然失败。

有什么办法可以解决此错误? 非常感谢

We created a multi-language C# .NET webform website in Visual Studio Community 2022.

When the website is browsed in the computers with Visual Studio installed, everything is fine. However, when the website is browsed in the computers without Visual Studio, there is an error:

Server Error in '/dev/websitename' Application. Stack Trace:

[MissingManifestResourceException: Could not find any resources
appropriate for the specified culture or the neutral culture. Make
sure "ProjectName.App_GlobalResources.Lang.resources" was correctly
embedded or linked into assembly "ProjectName" at compile time, or
that all the satellite assemblies required are loadable and fully
signed.]
System.Resources.ManifestBasedResourceGroveler.HandleResourceStreamMissing(String
fileName) +441
System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo
culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean
createIfNotExists, StackCrawlMark& stackMark) +1219
System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo
requestedCulture, Boolean createIfNotExists, Boolean tryParents,
StackCrawlMark& stackMark) +1008
System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo
requestedCulture, Boolean createIfNotExists, Boolean tryParents,
StackCrawlMark& stackMark) +1008
System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo
culture, Boolean createIfNotExists, Boolean tryParents) +43
System.Resources.ResourceManager.GetString(String name, CultureInfo
culture) +567 Projectname.filename.funcationname() in
C:\Users\Path\filename.aspx.cs:80
System.Web.UI.Control.OnLoad(EventArgs e) +108
System.Web.UI.Control.LoadRecursive() +90
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+1533 Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4330.0

The function causes the error that gets the text to show based on the language selected.
In the function, the scripts are:

Thread.CurrentThread.CurrentCulture = new CultureInfo(Session["Lang"].ToString());
rm = new ResourceManager("ProjectName.App_GlobalResources.Lang", Assembly.GetExecutingAssembly());
ci = Thread.CurrentThread.CurrentCulture;

The properties of the languages resx files are:

  1. Build Action: Embedded Resources
  2. Custom Tool: GlobalResourceProxyGenerator
  3. Copy to Output Directory: Do not copy

We tried

  1. Change the setting to : Copy if newer
  2. Use a new resx files
    but still failed.

Is there any way we can solve this error?
Many Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文