简体   繁体   English

通过Visual Studio 2012使用IIS Express时,无法识别resx更改

[英]When using IIS Express through Visual Studio 2012, resx changes are not recognized

In my html code of a C# web application I have the resx references as: 在C#Web应用程序的html代码中,我的resx引用为:

ul class="inlineList" li fmt:message key="scrollabletable.footer" / span data-bind="text: firstDisplayedRowNumber() + '-' + lastDisplayedRowNumber()" /span fmt:message key="scrollabletable.pager" / span data-bind="text: itemCount"> ul class =“ inlineList” li fmt:message key =“ scrollabletable.footer” / span data-bind =“ text:firstDisplayedRowNumber()+'-'+ lastDisplayedRowNumber()” / span fmt:message key =“ scrollabletable.pager” / span data-bind =“ text:itemCount”>

The resx code: resx代码:

<data name="scrollabletable.footer" xml:space="preserve">
    <value> Showing </value>
</data>

<data name="scrollabletable.pager" xml:space="preserve">
    <value> of </value>
</data>

When I view the website through ASP.NET VS Server, I can see the strings from resx displayed. 通过ASP.NET VS Server查看网站时,可以看到显示的来自resx的字符串。 But when I use IIS express, those ("Showing", "of") don't get displayed. 但是,当我使用IIS Express时,那些(“显示中”,“的”中)不会显示。

Any idea why? 知道为什么吗?

About your last comment on your post: 关于您对帖子的最新评论:

It looks like you're using a namespace fmt on an attribute of a li element. 似乎您在li元素的属性上使用名称空间fmt Assuming you have the following: 假设您具有以下条件:

<!DOCTYPE html>
<html>
<head>
    <!-- some stuff here -->
</head>
<body>
    <!-- some stuff here -->
    <ul class="inlineList">
        <li fmt:message key="scrollabletable.footer" />
        <span data-bind="text: firstDisplayedRowNumber() + '-' + lastDisplayedRowNumber()" />
    <span fmt:message key="scrollabletable.pager" />
    <span data-bind="text: itemCount"> 
    <!-- other stuff below -->

The problem is not with your RESX. 问题不在于您的RESX。 It's with the fmt namespace on the message attribute. 它与message属性上的fmt名称空间一起使用。 fmt is an unrecognized namespace in HTML since HTML has no concept of namespaces. fmt是HTML中无法识别的名称空间,因为HTML没有名称空间的概念。 XHTML, on the otherhand, has the concept of namespaces. 另一方面,XHTML具有名称空间的概念。 When using XHTML, there's nothing stopping you from having other namespaces declared, either. 使用XHTML时,也不会阻止您声明其他名称空间。 I suggest trying the following: 我建议尝试以下方法:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fmt="urn:fmt-namespace-here" xml:lang="en">
<head>
    <!-- some stuff here -->
</head>
<body>
    <!-- some stuff here -->
    <ul class="inlineList">
        <li fmt:message key="scrollabletable.footer" />
        <!-- NOTE: Instead of specifying the namespace in the html element, you could
                   also do the following:
        <li fmt:message key="scrollabletable.footer" xmlns:fmt="urn:fmt-namespace-here" />
        -->
        <span data-bind="text: firstDisplayedRowNumber() + '-' + lastDisplayedRowNumber()" />
    <span fmt:message key="scrollabletable.pager" />
    <span data-bind="text: itemCount"> 
    <!-- other stuff below -->

In the example above, you've declared your namespace fmt and now the document processor will know about it and recognize it. 在上面的示例中,您已经声明了名称空间fmt ,现在文档处理器将知道它并可以识别它。

NOTE: Since you didn't include spaces before your sample HTML in your OP, I sort of had to guess at what you wrote since all < and > disappeared, and possibly other content following those characters. 注意:由于您在OP中的示例HTML之前没有包含空格,因此我不得不猜测所有<>消失了之后,以及这些字符后面的其他内容之后您所写的内容。

HTH. HTH。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Visual Studio Express 2012中添加resx文件? - How to add resx file in visual studio express 2012? 在Visual Studio 2012中进行调试时将IIS Express更改为全功能IIS - Change IIS Express to full functions IIS when debug in Visual Studio 2012 为什么IIS 8.0 Express在Visual Studio 2012中重命名后使用旧项目名称 - Why is IIS 8.0 Express using the old project names after rename in Visual Studio 2012 当我通过 Visual Studio 中的 IIS Express 在浏览器中打开 web 应用程序时,为什么会给我这个错误? - Why give me this error when I open web app in browser through IIS Express in visual studio? 在Visual Studio 2012中打开.resx文件时,显示“操作无法完成。 指针无效“错误 - When opening a .resx file in Visual Studio 2012, gives “The operation could not be completed. Invalid pointer” error 扩展Visual Studio 2012 Express - Extending Visual Studio 2012 Express 从 iPad 连接到 Visual Studio (IIS Express) 时出现登录问题 - Login issue when connecting to Visual Studio (IIS Express) from iPad 在Visual Studio Express 2010中打开Visual Studio Express 2012项目 - Opening Visual Studio Express 2012 projects in Visual Studio Express 2010 在 Visual Studio 上通过 IIS Express 运行时可以加载图像,但通过 IIS 运行时无法加载 - Image can load when running by IIS Express on Visual studio, but can't load when running by IIS Visual Studio 2012无法识别代码更改 - visual studio 2012 is not recognizing changes in code
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM