2013年7月17日 星期三

已停用處理序效能計數器

查看事件檢事器訊息有下列幾種

System.InvalidOperationException 已停用處理序效能計數器,所以無法執行所要求的作業

無法讀取伺服器服務的效能資料。Data 區段的前四個位元組 (DWORD) 包含狀態碼、接下來的四個位元組包含 IOSB.Status,再接下來的四個位元組包含 IOSB.Information。

解除載入服務WmiApRpl (WmiApRpl) 的效能計數器字串時失敗。 錯誤碼是資料區段中的第一個DWORD。

參考 Event ID 3012 — Performance Counter Loading

Resolve

Rebuild the list of available counters

Membership in the local Administrators group is required to complete this procedure.
To rebuild the list of counters in the registry:
  1. Click Start, expand All Programs, and expand Accessories.
  2. Right-click Command Prompt, and then click Run as administrator.
  3. At the command prompt, type lodctr /r, and then press ENTER.

2013年7月16日 星期二

IIS 8 MVC4 網站

將WEBSITE部署到 windows 2012時出現幾個狀況

無法載入檔案或組件 'Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' 或其相依性的其中之一。 系統找不到指定的檔案。

解決方法:
publish時bin檔下也沒這個檔,所以到 http://www.asp.net/mvc/mvc4 去下載mvc4,安裝完後就OK了。

[FileLoadException: 找到的組件資訊清單定義與組件參考不符。 (發生例外狀況於 HRESULT: 0x80131040)]

[FileLoadException: 無法載入檔案或組件 'Microsoft.ReportViewer.Common, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' 或其相依性的其中之一。 找到的組件資訊清單定義與組件參考不符。 (發生例外狀況於 HRESULT: 0x80131040)]


解決方法:
因有安裝了reportviwer 2012 runtime,可能有CACHE,故重啟IIS 網站所用到的應用程式集區即OK。

2013年7月10日 星期三

HttpException Request timed out

同事反應專案下某個網頁查詢功能突然嗝屁了,輸入查詢條件,按下查詢鍵後,然後等了一些時間後,就出現
[HttpException (0x80004005):要求已經逾時。]的錯誤。

回報說,是突然間才有這個問題,以前都沒有問題,
然後也沒改這隻程式A的程式碼....

自已陸續測了好幾天,也覺得狀況是時好時壞.... 遇到鬼了...

最後,凶手找到了...

就是同事改了另一隻程式B....里頭寫了一段ENDLESS LOOP(當然也是在查些條件下才會發生...難怪我覺得遇到鬼了....)

然後在有問題的這隻程式A中,在一個大家都想不到的地方呼叫程式B(我們壓根都想不到要去測這段程式碼....冏....)

 一切都是誤會. 唉


2013年5月7日 星期二

SQL2012 shortcut key

安裝SQL 2012後,以前一些常用的捷徑鍵都不work了.
其實也只有幾個常用鍵

Ctrl+R  : 將query result pane 關掉
Ctrl+Shift+C : 註解所選的sql指令碼
Ctrl+Shift+R : 反註解所選的sql指令碼

可能因為是SSMS2012改用了vs2010 shell ,所以變成有些按鍵被更改掉了.

這里可參考SQL2012的shortcut鍵

為了方便所以在SSMS 2012 中
Tool-->Customize -->Keyboard ,在Show commands containing: 輸入comment
找到了
Edit.CommentSelection  
Edit.UncommentSelection 
 接著在Use new shourtcut in : 選擇SQL Query Editor , 然後按下所要的捷徑。
Edit.CommentSelection    --> Ctrl+Shift+C
Edit.UncommentSelection --> Ctrl+Shift+R




2013年4月19日 星期五

win2003 r2記憶體使用設定

人客的一個系統要更換到一台新主機上,規格如下
  1. 型號:HP ProLiant DL380 G7
  2. CPU:Intel Xeon CPU E5620 @ 2.40GHz *2 四核
  3. RAM:32GB ( 32758 MBytes)
  4. OS: Microsoft Windows Server 2003 Enterprise Edition R2

因為參考舊機器boot.ini(16GB記憶體)
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003, Enterprise" /noexecute=optout /fastdetect /PAE /3GB /USERVA=2900

結果重開機後原本32GB的記憶體只剩下16GB

查看了幾篇文章後....

原來win 2003 超過16GB實體記憶體時,/3GB 不可使用,否則機器仍只會使用16GB的記憶體.

 這篇說明的還蠻詳細的. 
 Using the 3GB and PAE switches when running SQL 2005 causes issues
boot.ini設定方式
 
For system with more than 16GB RAM
/PAE

For systems with between 4GB – 16GB RAM
/PAE /3GB /USERVA=3000
/PAE /3GB /USERVA=2900
/PAE /3GB /USERVA=2800
/PAE

For systems with 4GB RAM or less.
/3GB
/3GB /USERVA=3000
/3GB /USERVA=2900
/3GB /USERVA=2800

Do not set the USERVA values less than 2800 or more than 3072. 
Large memory support is available in Windows Server 2003 and in Windows 2000
這篇KB則說明不設PAE則AWE也無法使用超過4GB的RAM


How to: Enable the Lock Pages in Memory Option (Windows)
使用AWE前要先確定sql server services啟動帳戶是否有啟用鎖定記憶體分頁權限


SQL SERVER上配合設定啟用AWE
sp_configure 'show advanced options', 1
RECONFIGURE
GO
sp_configure 'awe enabled', 1
RECONFIGURE
GO 
sp_configure 'min server memory', 1024
RECONFIGURE
GO
sp_configure 'max server memory', 30720
RECONFIGURE
GO

這篇列出作業系統記憶體上限
Memory Limits for Windows Releases

Windows Server 2003 R2 Enterprise Edition 64 GB(16 GB with 4GT)

最後的boot.ini為下
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003, Enterprise" /noexecute=optout /fastdetect /PAE

 

2013年4月17日 星期三

系統捷徑失效,icon消失?

OS: win7 64bit
最近不知裝了什麼,有時電腦開始或工作列上的一些系統捷徑就突然都失效了.icon也變成不知的圖示.

今天電腦用到一半,又出現了有部份的捷徑失效..

當我要打開visual studio 2010 (這個在開始上的捷徑及icon看來都是OK的) 時竟然出現 這個錯誤.

Exception has been thrown by the target of an invocation.

後來只好登出再登入後,整個才又正常了起來。


2013/05/07
今早做完sql 2012 sp1 KB更新後,變成系統捷徑原有的icon都消失了。重新登入或開機也無法回復,但捷徑點進去功能又是OK的。

後來看到這篇 [Windows7]修復桌面與開始功能表中錯亂或是消失的捷徑圖示

將C:\Users\beverly\AppData\Local\IconCache.db 刪除重開機就OK了..

幾次經驗下來,安裝或更新sql 2012、vs2012後都會出現這種奇怪的狀況.實在是不解啊....

2013年4月10日 星期三

查看sql server error log

--保留多少個error log (例100個)
exec master..xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'NumErrorLogs', REG_DWORD, 100


--查看目前共有幾個error log
exec master..xp_enumerrorlogs

--重新產生一個error log
exec master..sp_cycle_errorlog

--查看第幾個log內容(由0開始, 例第13個)
exec master..sp_readerrorlog 12

VS CODE離線安裝套件方式-續

去年 vscode離線安裝 powershell nupkg 今年在一台無外網的 windwos 2025上安裝時遇到了powershell版本一直讀取到了5.1的版本,鬼打牆了一下午,在VM還原重測測了好幾回,應該是可行了。 將下載到的免安裝powershell 解壓縮到...