Message: "The format name specified is invalid. "
Source: "MSMQManagement"
when I execute the Init command.
below is my code:
MSMQ.MSMQApplicationClass msmq;
MSMQ.MSMQManagementClass qMgt;
MSMQ.MSMQQueueInfo qInfo;
string id = string.Empty;
object[] queues;
object machineName;
object queueFormatName;
object missingParam;
MSMQ.MSMQApplicationClass msmq;
MSMQ.MSMQManagementClass qMgt;
string id = string.Empty;
object[] queues;
object machineName;
object queueFormatName;
object missingParam;
try
{
missingParam = Type.Missing;
machineName = SystemInformation.ComputerName;
msmq = new MSMQ.MSMQApplicationClass();
queues = msmq.PrivateQueues as object[];
queueFormatName = string.Format("DIRECT=OS:.\nsaprocess",
queueFormatName);
qMgt = new MSMQ.MSMQManagementClass();
qMgt.Init(ref machineName, ref missingParam, ref queueFormatName);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
What format is it looking for?
Thanks
It might be easier to use the System.Management namespace to access the
WMI objects representing the MSMQ performance counters. At least it
would be if you were accessing local counters. Since you are accessing
a remote system's counters things might get a bit messier - I've never
tried remote WMI.
> queueFormatName = string.Format("DIRECT=OS:.\nsaprocess",
> queueFormatName);
There are a couple of odd looking things about this statement. First of
all, the first parameter to string.Format() generally contains one or
more format items (i.e., curly braces containing a number and possibly
other formatting controls like width etc.) into which the text
representation of the corresponding subsequent parameter is inserted.
This call to string.Format doesn't have any format items in the format
string parameter? If insertion/formatting of the other parameters isn;t
required, wouldn;t a simple string assignment statement suffice?
Second, \n in the string literal is going to be interpreted as the
newline character and not as the backslash character followed by the
lower case n character. You either need two backslash characters to
escape the escape sequence or you need to prefix the string literal with
an ampersand as escape sequences in @-quoted literals are not processed.
"Frank Boyne" <frank...@unisys.com> wrote in message
news:OArFBLn...@TK2MSFTNGP06.phx.gbl...