2020年11月26日 星期四

【C#】XDocument Descendants() 取不到東西

 string xml = @"<?xml version='1.0' encoding='utf-8'?>
                <ComputerBuildReportRequest xmlns:i='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://schemas.ms.it.oem/digitaldistribution/2010/10'>
                    <Bindings>
                        <Binding>
                            <ProductKeyID>1000000002</ProductKeyID>
                            <HardwareHash>xxx</HardwareHash>
                            <HXSpecifics>
                                <UnitPartNumber>123456-789</UnitPartNumber>
                            </HXSpecifics>
                        </Binding>
                        <Binding>
                            <ProductKeyID>1000000003</ProductKeyID>
                            <HardwareHash>yyy</HardwareHash>
                            <HXSpecifics>
                                <UnitPartNumber>123456-787</UnitPartNumber>
                            </HXSpecifics>
                        </Binding>
                      </Bindings>
                </ComputerBuildReportRequest>";
XDocument doc = XDocument.Parse(xml);
var elements = doc.Descendants("Binding"); // empty
以前就碰過,一直懶得研究 XDocument 到底為什麼有時候會秀逗,直接改用 XmlDocument。 這次碰到非用不可的情況,就藉機深究下。 

2020年6月27日 星期六

2019年5月28日 星期二

【MS-SQL】Can't open .trc file generated by SQLDiag

想直接雙擊打開 SQLDiag 錄的 trc 但會碰到

SQL Server Profiler
Failed to open a file. Access is denied.
的錯誤視窗

【MS-SQL】SQLDiag debug

要跑 SQLDiag 的時候發生錯誤,錄完之後沒產生 trc 檔,cmd 有以下錯誤。
\ Error querying installation path for SQLDIAG on . Function result: 2. Message: The system cannot find the file specified.

2019年5月21日 星期二

【WCF】500 InternalServerError The server encountered an error processing the request. See server logs for more details

Error Status Code: 'InternalServerError'
Details: The server encountered an error processing the request. Please see the server logs for more details.

但 Visual Studio 沒有拋出任何 exception。

2018年11月26日 星期一

2018年11月24日 星期六

【MS-SQL】Connection pool

Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.

2018年11月15日 星期四

【MS-SQL】BACKUP LOG cannot be performed because there is no current database backup

BACKUP LOG cannot be performed because there is no current database backup

不確定是 shrink 還是改 log size 或其他什麼的,突然沒辦法用之前做的 full back 還原。

【MS-SQL】The transaction log for database 'DatabaseName' is full due to 'LOG_BACKUP'

The transaction log for database 'DatabaseName' is full due to 'LOG_BACKUP'

2018年8月20日 星期一