总是提示以下错误:“/WebShop”应用程序中的服务器错误。
--------------------------------------------------------------------------------未能在给定的程序集中找到任何适合于指定的区域性(或非特定区域性)的资源。请确保已将“WebShop.default_WebShop.resources”正确嵌入或链接到程序集“WebShop”。 baseName: WebShop.default_WebShop locationInfo: <null> resource file name: WebShop.default_WebShop.resources assembly: WebShop, Version=1.0.1719.15571, Culture=neutral, PublicKeyToken=null 说明:
源码如下
this.rm = new ResourceManager("WebShop.default_WebShop", typeof(WebForm1).Assembly);this.rm.GetString("nogoods_InnerHtml");我已经将WebShop.default_WebShop.resources文件放在WebShop的bin目录下

解决方案 »

  1.   

    帮你up,我还没在webform里使用过资源文件.
      

  2.   

    resgen gb.txt ErrorMessage.gb.resources 
    al /t:lib /c:en-GB /embed:gErrorMessage.gb.resources  /out:ErrorMessage.GB.dllusing System.Resources; 
    using System.Reflection;
    AssemblyName am = AssemblyName.GetAssemblyName(@"d:\gb\errormessage.gb.dll");
    Assembly assem = Assembly.Load(am);
    ResourceManager rm = new  ResourceManager("ErrorMessage.GB",assem);     
    string str = rm.GetString("01.001.00001");
      

  3.   

    using System;
    using System.Resources;
    using System.Globalization;
    using System.Threading;
    using System.Reflection;namespace SystemFramework.Dictionary
    {
    /// <summary>
    /// clsResourceManager 的摘要说明。
    /// </summary>
    public class Dictionary
    {
    private string DictKey="dictionary";
    private string LanguageTag; private ResourceManager dictionary;

    public Dictionary(string languageTag)
    {
    LanguageTag=languageTag;
    LoadDictionary(Assembly.GetCallingAssembly());
    //LoadDictionary(Assembly.GetExecutingAssembly());
    } public Dictionary(Assembly dictionaryAssembly,string languageTag)
    {
    LanguageTag=languageTag;
    LoadDictionary(dictionaryAssembly);
    } public Dictionary(string resourceName,Assembly dictionaryAssembly)
    {
    dictionary=new ResourceManager(resourceName,dictionaryAssembly);
    } private void LoadDictionary(Assembly dictionaryAssembly)
    {
    DictKey="dictionary" + "." + LanguageTag.ToLower();
    string[] dictionaryNames=dictionaryAssembly.GetManifestResourceNames();
    string dictionaryName="";
    for(int i=0;i<dictionaryNames.Length;i++)
    {
    if (dictionaryNames[i].IndexOf(DictKey)>=0)
    {
    dictionaryName=dictionaryNames[i];
    dictionaryName=dictionaryName.Substring(0,dictionaryName.Length-10);
    break;
    }
    }
    if (dictionaryName!="")
    dictionary=new ResourceManager(dictionaryName,dictionaryAssembly);
    else
    dictionary=null;
    } public string this[string name]
    {
    get
    {
    return dictionary.GetString(name);
    }
    }

    }
    }//一个多语言数据词典的资源文件管理的类,你参考一下吧!
    //因有很多资源文件,数据词典资源文件的命名为***.dictionary.eng.resx等
      

  4.   

    那用XML不一样嘛?不过好像资源文件本身就是XML格式的吧?是否.Net提供了一些类方便操作的?
      

  5.   

    我看过一篇文章,是用资源文件存图片,这样的话,你的程序打包,就不会需要那么多图片了。尤其像你产品的logo不想被替换掉等时候用,当创建自定义控件时,情况也是如此 - 图像被用户下载之前通常需要存储在磁盘上。作为控件的编写者,您可能希望能够提供一个程序集,其中不仅包括控件,而且还包括相应的默认图像。http://www.microsoft.com/china/msdn/archives/library/dndotnet/html/servingimages.asp
      

  6.   

    应该要把WebShop.default_WebShop.resources编译进DLL程序集里吧
      

  7.   

    Resource文件不是放在BIN目录下,而是放在虚拟目录的根目录中
      

  8.   

    http://chs.gotdotnet.com/quickstart/aspplus/doc/resourcefiles.aspx
      

  9.   

    问题解决了,我将资源文件改名为default_WebShop.resources放到bin目录下(实际可在任何目录下),然后进行如下工作:(菜单)
    项目->添加现有项->所有文件(*.*)->default_WebShop.resources
    就可在“解决方案资源管理器”中看到该文件,问题也就解决了。结论:资源文件名应为(default_WebShop.resources)
    在程序中调用时应为:
    this.rm = new ResourceManager("WebShop.default_WebShop", typeof(WebForm1).Assembly);
      

  10.   

    你这样并不好.resources文件有时会发生锁死的
    因为.resources 文件不象 DLL 那样是影像复制的
      

  11.   

    在MSDN中有一张,非常详细的说明了资源文件在WINFORM 和WEBFORM中使用的方法和建议
    建议大家多看看。