Cannot determine whether a queue with the specified format name exists

前端 未结 5 1841
情歌与酒
情歌与酒 2021-02-04 04:28

I get the exception when executing the following code. Any ideas what is wrong?

string queueName = \"FormatName:Direct=TCP:1.1.1.1\\\\Private$\\\\test\";
Message         


        
5条回答
  •  逝去的感伤
    2021-02-04 05:00

    The answer above with checking the exception message does work on systems that raise English-exceptions. My system raises Dutch-exceptions. I get "De time-out voor de gevraagde bewerking is verstreken." So it's not a very robust solutions The exception has a property MessageQueueErrorCode that should be used to check whether or not an IOTimeout occurred.

    So it's better to use

    return (ex.MessageQueueErrorCode == MessageQueueErrorCode.IOTimeout);
    

    instead of:

    return ex.Message.StartsWith("Timeout");
    

提交回复
热议问题