- - PR -
VS2005のWebサービスでリソースファイルを使う方法
1
投稿者 | 投稿内容 |
---|---|
|
投稿日時: 2006-05-17 15:48
VS2005でWebサービスを作成し、リソースファイルを用いて文字列の多言語対応を行おうとしています。
ファイルを作成し、プロジェクトの「App_GlobalResources」ディレクトリに追加はしたのですが、リソースを呼び出すことができません。 VS2003では、以下のようなコードで呼び出すことができていました。 --------------------- System.Resources.ResourceManager rmgr; System.Reflection.Assembly LRMSAssembly; LRMSAssembly = this.GetType().Assembly; rmgr = new System.Resources.ResourceManager("(プロジェクト名).(リソースファイル名)", LRMSAssembly); string mes = rmgr.GetString("(リソースのキー)"); --------------------- --------------------- 発生するエラー: System.Resources.MissingManifestResourceException: 指定されたカルチャまたはニュートラル カルチャに対して適切なリソースが見つかりませんでした。"Resource.resources" が適切に埋め込まれたか、実行時にアセンブリ "App_Code.5shgrusj" にリンクされたか、または必要なサテライト アセンブリが読み込まれて完全に署名されていることを確認してください。 場所 System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents) 場所 System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents) 場所 System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents) 場所 System.Resources.ResourceManager.GetString(String name, CultureInfo culture) 場所 System.Resources.ResourceManager.GetString(String name) 場所 Service.HelloWorld() 場所 c:\Documents and Settings\mmiuser\My Documents\Visual Studio 2005\WebSites\WebSite4\App_Code\Service.cs:行 23 --------------------- 上記のコード中に(プロジェクト名)とありますが、VS2005のWebプロジェクトはプロジェクトという概念がなくWebサイトとなってしまったため、ファイルの位置を指定する方法を変えなければいけないかとは思うのですが、そこが分かりません。 なお、以下のサイトでWebアプリケーションの場合の対応方法を見つけたのですが、Webサービスを使用する場合にうまく応用できません。 http://www.atmarkit.co.jp/fdotnet/dotnettips/445aspmultilangres/aspmultilangres.html おわかりの方、よろしくご教授ください。 |
1