Commerce Server General - Exception thrown when using MessageManager

This is Interesting: Free IT Magazines  
Home > Archive > Commerce Server General > September 2005 > Exception thrown when using MessageManager





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Exception thrown when using MessageManager
ams8764@netscape.net

2005-08-30, 5:58 pm

Hi,

I am trying to use Commerce Server Message Manager as a storage for all
strings that should be translated for our ASP.NET/C#/CommerceServer
site (not only for pipeline customization).

I've built 2 satellite assemblies (one for en-US and the other for
fr-FR) following the documentation example, but when I try to retrieve
a translation, I'm getting the following error :

Microsoft.CommerceServer.Runtime.CommerceException: The message
"BadPassword" for the culture "en-US" could not be found in the
satellite assemblies

My code is
Microsoft.CommerceServer.Internal.Common.CommerceMessages.GetCommerceMessage("BadPassword");

I've added the necessary entry in web.config :

<messageManager>
<cultures default="en-US" baseName="rc" assembly="myapp">
<culture id="en-US" />
<culture id="fr-FR" />
</cultures>
<resources>
<resource id="BadPassword" />
</resources>
</messageManager>


baseName and assembly are correctly set because when I change them I
get messages like "cannot load xxx".

I do have a bin/en-US/myapp.resources.dll

i've tried adding a non existing resource to web.config, and I also get
another error message, so i'm confident the resource is actually in the
satellite assembly.

My original XML file contained

<MessageManager DefaultLanguage="English">


<Language Name="English" Locale="1033"/>
<Language Name="French" Locale="1036"/>

<Entry Name="BadPassword" Type ="Auth">
<Value Language="English">Invalid password</Value>
<Value Language="French">Mot de passe invalide</Value>
</Entry>

</MessageManager>

(somehow I never found the use for my "Auth" type).

I then run

rcxml2resx rc.xml rc.resx

then

resgen rc.en-US.resx

then

al /embed:rc.en-US.resources /culture:en-US /out:myapp.resources.dll

then deployed the myapp.resources.dll to the bin subdir en-US

What could be wrong ?

Thanks in advance ...

By the way, does it make sens to store site error messages in the
MessageManeger of CS ?

We are using CS 2002 SP3 with Windows 2000 Advanced Server.

Sorry for the long message...

-- AMS

Nihit Kaul [MSFT]

2005-09-14, 5:52 pm

Hi AMS,

I don't think the MessageManager is meant to be used much outside the
pipelines (especially on ASP.Net sites since there are much better resource
management options natively with .Net) and that is why there is no easy way
to handle the strings in the MessageManager through managed code. I would
not suggest that you use this for storing your site resources, especially
on an ASP.Net site. For ASP sites you can look at any of the ASP sitelets
global.asa for an example of how to load and populate the MessageManager
object from the rc.xml file directly.

If you do want to use the MessageManager, I believe the following hack
should work as well but it is defintely not the recommended solution:

PipelineInfo basketPipeInfo = new PipelineInfo("Basket");
MessageManagerClass msgMgr =
(MessageManagerClass)basketPipeInfo["MessageManager"];
String badCCMessage = msgMgr.GetMessage("pur_badcc", "en-US");

Heop this helps.

Thanks,

Nihit Kaul[MSFT]
Commerce Server
http://blogs.msdn.com/nihitk

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
--------------------
From: ams8764@netscape.net
Newsgroups: microsoft.public.commerceserver.general
Subject: Exception thrown when using MessageManager
Date: 30 Aug 2005 07:57:13 -0700
Organization: http://groups.google.com
Lines: 83
Message-ID: <1125413833.356314.126030@z14g2000cwz.googlegroups.com>
NNTP-Posting-Host: 62.23.237.17
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1125413842 31987 127.0.0.1 (30 Aug 2005
14:57:22 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Tue, 30 Aug 2005 14:57:22 +0000 (UTC)
User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;
.NET CLR 1.1.4322),gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: z14g2000cwz.googlegroups.com; posting-host=62.23.237.17;
posting- account=PZ8s3Q0AAAAmg38VabALoICeANiC6nY1

Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTFEED02.phx.gbl!tornado.fastwebnet.it!tiscali!ne
wsfeed1.ip.tiscali.net!news.glorb.com!postnews.google.com!z14g2000cwz.google
groups.com!not-for-mail
Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.commerceserver.general:3322
X-Tomcat-NG: microsoft.public.commerceserver.general

Hi,

I am trying to use Commerce Server Message Manager as a storage for all
strings that should be translated for our ASP.NET/C#/CommerceServer
site (not only for pipeline customization).

I've built 2 satellite assemblies (one for en-US and the other for
fr-FR) following the documentation example, but when I try to retrieve
a translation, I'm getting the following error :

Microsoft.CommerceServer.Runtime.CommerceException: The message
"BadPassword" for the culture "en-US" could not be found in the
satellite assemblies

My code is
Microsoft.CommerceServer.Internal.Common.CommerceMessages.GetCommerceMessage
("BadPassword");

I've added the necessary entry in web.config :

<messageManager>
<cultures default="en-US" baseName="rc" assembly="myapp">
<culture id="en-US" />
<culture id="fr-FR" />
</cultures>
<resources>
<resource id="BadPassword" />
</resources>
</messageManager>


baseName and assembly are correctly set because when I change them I
get messages like "cannot load xxx".

I do have a bin/en-US/myapp.resources.dll

i've tried adding a non existing resource to web.config, and I also get
another error message, so i'm confident the resource is actually in the
satellite assembly.

My original XML file contained

<MessageManager DefaultLanguage="English">


<Language Name="English" Locale="1033"/>
<Language Name="French" Locale="1036"/>

<Entry Name="BadPassword" Type ="Auth">
<Value Language="English">Invalid password</Value>
<Value Language="French">Mot de passe invalide</Value>
</Entry>

</MessageManager>

(somehow I never found the use for my "Auth" type).

I then run

rcxml2resx rc.xml rc.resx

then

resgen rc.en-US.resx

then

al /embed:rc.en-US.resources /culture:en-US /out:myapp.resources.dll

then deployed the myapp.resources.dll to the bin subdir en-US

What could be wrong ?

Thanks in advance ...

By the way, does it make sens to store site error messages in the
MessageManeger of CS ?

We are using CS 2002 SP3 with Windows 2000 Advanced Server.

Sorry for the long message...

-- AMS


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com