資源簡介
通過C# 調用MSMQ 微軟消息隊列
代碼片段和文件信息
using?System;
using?System.Diagnostics;
using?System.Messaging;
using?System.Collections.Generic;
namespace?MsmsInfo
{
????class?SendTools
????{
????????public?void?SendDemo()
????????{
????????????MessageQueue?queue?=?new?MessageQueue(“jimmyibm\\private$\\msg“);
????????????Stopwatch?stopWatch?=?new?Stopwatch();
????????????stopWatch.Start();
????????????const?int?MAX_NUMBER?=?5000;
????????????for?(int?i?=?1;?i?<=?MAX_NUMBER;?i++)
????????????{
????????????????Message?msg?=?new?Message();
????????????????//這里隨便設點兒測試值
????????????????msg.Label?=?i.ToString();
????????????????msg.Body?=?i.ToString().PadLeft(8?‘0‘);
????????????????//msg.Recoverable?=?true;//設置消息可恢復(即服務器重啟后,消息還在,但是啟用這個選項將會使發送時間加倍,因為“可恢復“的機制就是先在服務器硬盤生成文本文件,多了一次寫文件的IO操作)
????????????????q
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-06-04?10:36??MSMQ\.vs\
?????目錄???????????0??2018-06-04?10:36??MSMQ\.vs\MsmsInfo\
?????目錄???????????0??2018-06-04?10:36??MSMQ\.vs\MsmsInfo\v14\
?????文件???????48640??2018-06-13?09:46??MSMQ\.vs\MsmsInfo\v14\.suo
?????文件??????170437??2017-08-01?13:19??MSMQ\MsmsInfo.7z
?????文件????????1687??2018-06-04?10:59??MSMQ\MsmsInfo.sln
?????文件???????49152??2018-06-02?17:31??MSMQ\MsmsInfo.suo
?????目錄???????????0??2018-06-12?10:25??MSMQ\MsmsInfo\
?????文件????????3711??2018-06-12?10:30??MSMQ\MsmsInfo\app.config
?????目錄???????????0??2018-06-04?10:58??MSMQ\MsmsInfo\bin\
?????目錄???????????0??2018-06-04?10:58??MSMQ\MsmsInfo\bin\ddd\
?????文件????????3738??2018-06-04?10:57??MSMQ\MsmsInfo\bin\ddd\MsmsInfo.exe.config
?????文件???????22696??2018-06-04?10:58??MSMQ\MsmsInfo\bin\ddd\MsmsInfo.vshost.exe
?????文件????????3738??2018-06-04?10:57??MSMQ\MsmsInfo\bin\ddd\MsmsInfo.vshost.exe.config
?????目錄???????????0??2018-06-04?10:28??MSMQ\MsmsInfo\bin\Debug\
?????文件??????249856??2014-02-14?12:01??MSMQ\MsmsInfo\bin\Debug\log4net.dll
?????目錄???????????0??2018-06-07?16:17??MSMQ\MsmsInfo\bin\Debug\Logs\
?????文件????????3097??2018-06-07?16:29??MSMQ\MsmsInfo\bin\Debug\Logs\MsmsInfo.log
?????文件?????????680??2018-06-04?17:32??MSMQ\MsmsInfo\bin\Debug\Logs\MsmsInfoAppender.logNotificationServer_20180604.log
?????文件?????????816??2018-06-07?16:29??MSMQ\MsmsInfo\bin\Debug\Logs\MsmsInfoAppender.logNotificationServer_20180607.log
?????文件?????????816??2017-07-31?10:15??MSMQ\MsmsInfo\bin\Debug\Logs\NotificationServer_20170731.log
?????文件?????????680??2018-06-04?17:32??MSMQ\MsmsInfo\bin\Debug\Logs\NotificationServer_20180604.log
?????文件?????????816??2018-06-07?16:29??MSMQ\MsmsInfo\bin\Debug\Logs\NotificationServer_20180607.log
?????文件?????????446??2017-07-31?10:15??MSMQ\MsmsInfo\bin\Debug\Logs\Protocol-NS.log
?????文件???????28672??2018-06-07?16:29??MSMQ\MsmsInfo\bin\Debug\MsmsInfo.exe
?????文件????????3738??2018-06-04?10:57??MSMQ\MsmsInfo\bin\Debug\MsmsInfo.exe.config
?????文件???????62976??2018-06-07?16:29??MSMQ\MsmsInfo\bin\Debug\MsmsInfo.pdb
?????文件???????22696??2018-06-07?16:29??MSMQ\MsmsInfo\bin\Debug\MsmsInfo.vshost.exe
?????文件????????3738??2018-06-04?10:57??MSMQ\MsmsInfo\bin\Debug\MsmsInfo.vshost.exe.config
?????目錄???????????0??2018-06-12?10:30??MSMQ\MsmsInfo\bin\Release\
?????文件??????249856??2014-02-14?12:01??MSMQ\MsmsInfo\bin\Release\log4net.dll
............此處省略112個文件信息
- 上一篇:wpf連接打印機demo
- 下一篇:C# 生成sql語句 小工具源碼
評論
共有 條評論