ASP.NET 中的资源是否需要编译?
我正在尝试使用 ASP.NET 4.0 构建多语言 Web 应用程序。我已经创建了适当的资源文件,并在 App_GlobalResources 中进行了翻译,从 VS 运行后一切正常,但令我惊讶的是没有生成附属程序集 (.resources.dll)。
当我将构建操作更改为“嵌入式资源”时,它们被创建,但在发布 IIS 后完全忽略它们并使用 App_GlobalResources 中的纯 .resx 文件。
这种行为正确吗?不会影响性能吗?或者我应该编译这些 .resx 文件并以某种方式指示我的应用程序使用它们?
I'm trying to build a multi-language web app with ASP.NET 4.0. I've created appropriate resource files with translations inside App_GlobalResources and after running from VS everything works fine, but i was suprised that no satellite assemblies (.resources.dll) were generated.
When I changed build action to "Embedded Resource" they were created but after publishing IIS completely ignores them and uses pure .resx files from App_GlobalResources.
Is that behaviour correct? Wouldn't it affect performance? Or should I compile these .resx files and somehow instruct my app to use them ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ASP.NET 确实“即时”编译它们,只是将它们放在您看不到的地方(例如:
%WINDIR%\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files< /code>),因此不会对性能产生巨大的影响,只是在应用程序第一次启动时或在编译的缓存不再有效(即您更改了它)时启动。
该程序集通常命名为 App_GlobalResources.xxxx.dll 之类的名称,其中 xxxx 是某个十六进制值。
ASP.NET does compile them "on the fly", it just puts them in a place you don't see (example:
%WINDIR%\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
), so there is no huge performance impact, just on application startup for the first time or on startup if the compiled cache is no longer valid (i.e. you changed it).The assembly is usually named something like
App_GlobalResources.xxxx.dll
where xxxx is some hex value.