<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel><title>Harry Chang&apos;s Blog</title><description>Harry會在這分享各種技術心得, 同時也會分享一些敏捷相關的想法與引導方法！</description><link>https://changyuhao625.github.io/</link><item><title>[Azure]Dotnet Core 3 Log With Application Insights</title><link>https://changyuhao625.github.io/tech/2020/08/05/dotnet-core-3-log-with-application-insights/</link><guid isPermaLink="true">https://changyuhao625.github.io/tech/2020/08/05/dotnet-core-3-log-with-application-insights/</guid><description>在 .Net Core 3 專案串接 Azure Application Insights：安裝 Microsoft.ApplicationInsights.AspNetCore，Startup.ConfigureServices 加入 AddApplicationInsightsTelemetry，並在 appsettings.json 設定 InstrumentationKey；預設僅記錄 Warning 以上等級，可在 ConfigureLogging 以 AddFilter&lt;ApplicationInsightsLoggerProvider&gt;…</description><pubDate>Wed, 05 Aug 2020 00:00:00 GMT</pubDate><category>dotnet core 3</category><category>Azure</category><category>Application Insights</category><category>ILogger</category><category>Logging</category><category>Telemetry</category><author>Harry Chang</author></item><item><title>[.Net Core] .Net Core 2.x Console Application 變成Windows Service!</title><link>https://changyuhao625.github.io/tech/2019/08/22/netcore-servicebase-windows-service/</link><guid isPermaLink="true">https://changyuhao625.github.io/tech/2019/08/22/netcore-servicebase-windows-service/</guid><description>.Net Core 3.0 之前沒有 ServiceBase 可直接使用，本文示範在 .Net Core 2.x 透過實作 IHostLifetime (ServiceBaseLifetime) 與 IHostedService，再寫 HostBuilder 擴充方法 UseServiceBaseLifetime/RunAsServiceAsync，最後以 sc create 把 Console Application 註冊成受 SCM 控管的 Windows Service。</description><pubDate>Thu, 22 Aug 2019 00:00:00 GMT</pubDate><category>.Net Core</category><category>.Net Core 2.x</category><category>ServiceBase</category><category>Windows Service</category><category>SCM</category><category>IHostedService</category><category>IHostLifetime</category><author>Harry Chang</author></item><item><title>[Docker] 如何在Windows Server上安裝Docker</title><link>https://changyuhao625.github.io/tech/2019/08/20/docker-install-on-windows-server/</link><guid isPermaLink="true">https://changyuhao625.github.io/tech/2019/08/20/docker-install-on-windows-server/</guid><description>在 Windows Server 2016 以上安裝 Docker EE 的踩坑紀錄：使用 PowerShell 以 Install-Module DockerMsftProvider 與 Install-Package -Name docker 安裝時會找不到 docker-19-03-1.zip，需先用 Start-BitsTransfer 下載並搭配 Get-FileHash 才能順利完成，最後以 Start-Service Docker 啟動。</description><pubDate>Tue, 20 Aug 2019 00:00:00 GMT</pubDate><category>Docker</category><category>Docker EE</category><category>Windows Server</category><category>PowerShell</category><category>DockerMsftProvider</category><author>Harry Chang</author></item><item><title>團隊共創法-隨手小記</title><link>https://changyuhao625.github.io/softskill/2019/07/20/the-consensus-workshop/</link><guid isPermaLink="true">https://changyuhao625.github.io/softskill/2019/07/20/the-consensus-workshop/</guid><description>團隊共創法五個步驟隨手小記：內容介紹（釐清焦點問題範疇）、腦力激盪（A5 卡片，每張 7–9 字）、組織群組（三輪依 Insight 直覺分群，前兩輪問深度/廣度）、命名群組（找背後洞見）、決定意義（用 ORID 收斂並決定行動）。</description><pubDate>Sat, 20 Jul 2019 00:00:00 GMT</pubDate><category>團隊共創法</category><category>Facilitator</category><category>Consensus Workshop</category><category>ORID</category><category>引導</category><author>Harry Chang</author></item><item><title>ORID 焦點討論法</title><link>https://changyuhao625.github.io/softskill/2019/07/18/orid-facilitator/</link><guid isPermaLink="true">https://changyuhao625.github.io/softskill/2019/07/18/orid-facilitator/</guid><description>ORID 焦點討論法是引導者入門工具之一，透過 O 客觀事實、R 情緒反映、I 詮釋意義、D 行動決定四個層次的提問，引導參與者自然思考；文中分享圍繞目標設計問題、拿捏顆粒度、避免「為什麼」、不預設立場、抓尾巴等引導技巧。</description><pubDate>Thu, 18 Jul 2019 00:00:00 GMT</pubDate><category>ORID</category><category>Facilitator</category><category>焦點討論法</category><category>引導</category><category>Scrum</category><author>Harry Chang</author></item><item><title>[EasyNetQ]如何透過EasyNetQ API 來操作RabbitMQ</title><link>https://changyuhao625.github.io/tech/2019/07/17/rabbitmq-with-easynetq/</link><guid isPermaLink="true">https://changyuhao625.github.io/tech/2019/07/17/rabbitmq-with-easynetq/</guid><description>部門為解決 Redis Pub/Sub 掉訊息、難監控、訊息無法持久化的風險改用 RabbitMQ；本文介紹 Fanout、Direct、Topic 三種 Exchange 機制，並以 docker-compose (rabbitmq:3-management) 建置環境，再用 EasyNetQ 的 RabbitHutch.CreateBus 實作 Direct 的 Producer 與 Consumer。</description><pubDate>Wed, 17 Jul 2019 00:00:00 GMT</pubDate><category>.Net</category><category>RabbitMQ</category><category>EasyNetQ</category><category>Docker</category><category>Message Queue</category><category>Pub-Sub</category><author>Harry Chang</author></item><item><title>[C#] Null 條件運算子(Null Conditional Operators)</title><link>https://changyuhao625.github.io/tech/2017/07/14/null-condition-operators/</link><guid isPermaLink="true">https://changyuhao625.github.io/tech/2017/07/14/null-condition-operators/</guid><description>介紹 C# Null 條件運算子 ?. 與合併運算子 ??：customer?.Id ?? &quot;123456&quot; 會在 customer 或 customer.Id 為 null 時回傳預設值，等同於 if (customer == null || customer.Id == null) 的判斷，把防空程式碼縮成一行。</description><pubDate>Fri, 14 Jul 2017 00:00:00 GMT</pubDate><category>C#</category><category>Null Conditional Operators</category><category>Null Coalescing</category><author>Harry Chang</author></item><item><title>[Asp.Net] Connection Pooling</title><link>https://changyuhao625.github.io/tech/2017/04/20/connection-pooling/</link><guid isPermaLink="true">https://changyuhao625.github.io/tech/2017/04/20/connection-pooling/</guid><description>解析 .Net SqlConnection Connection Pooling 機制：using 結束時連線並未真正釋放，而是回收進 Pool 供下一次同樣連線字串重用，約 4–8 分鐘才真正關閉；未正確釋放或 Pool Size 不足即可能觸發「已超過連接逾時的設定」，排查可檢查 using、Pool Size 與 Connection Lifetime。</description><pubDate>Thu, 20 Apr 2017 00:00:00 GMT</pubDate><category>Asp.Net</category><category>SqlConnection</category><category>Connection Pool</category><category>Performance</category><category>.Net</category><author>Harry Chang</author></item><item><title>[Asp.Net MVC] Razor Engine</title><link>https://changyuhao625.github.io/tech/2017/03/06/razor-engine/</link><guid isPermaLink="true">https://changyuhao625.github.io/tech/2017/03/06/razor-engine/</guid><description>在非 MVC 架構上透過 NuGet 安裝 RazorEngine，把 .cshtml 模板交給 Engine.Razor.RunCompile 編譯成 HTML，並可傳入 ViewModel；進階可使用 TemplateServiceConfiguration 設定 Namespaces 與 DelegateTemplateManager 等 View Config。</description><pubDate>Mon, 06 Mar 2017 00:00:00 GMT</pubDate><category>Asp.Net MVC</category><category>RazorEngine</category><category>View Engine</category><category>cshtml</category><author>Harry Chang</author></item><item><title>[Web API 2] 客製化ModelBinder</title><link>https://changyuhao625.github.io/tech/2017/03/01/web-api-model-binding/</link><guid isPermaLink="true">https://changyuhao625.github.io/tech/2017/03/01/web-api-model-binding/</guid><description>Web API 2 客製化 ModelBinder 時出現「無法從 BaseBinder 建立 IModelBinder」例外，原因是 MVC 的 System.Web.Mvc.IModelBinder 與 Web API 的 System.Web.Http.IModelBinder 雖同名但在不同元件，using 引錯就會衝突，MVC 6 之後合併才解決。</description><pubDate>Wed, 01 Mar 2017 00:00:00 GMT</pubDate><category>Model Binding</category><category>ModelBinder</category><category>Web API 2</category><category>Asp.Net</category><author>Harry Chang</author></item><item><title>[NHibernate] Session 與 Lazy Loading</title><link>https://changyuhao625.github.io/tech/2016/12/14/nhibernate-session-lazyloading/</link><guid isPermaLink="true">https://changyuhao625.github.io/tech/2016/12/14/nhibernate-session-lazyloading/</guid><description>NHibernate 在同一個 Session 內 Save 實體後再 Get，會直接回傳 Session 內原物件而不重新查詢或觸發 Lazy Loading；因此沒有先把 B 指給 A.B，就算 B 已存入 Session，也無法從 A.B 取得，需在 Save 前把關聯建立好。</description><pubDate>Wed, 14 Dec 2016 00:00:00 GMT</pubDate><category>NHibernate</category><category>Session</category><category>Lazy Loading</category><category>ORM</category><author>Harry Chang</author></item><item><title>[jQuery] $.isEmptyObject 小提醒 !</title><link>https://changyuhao625.github.io/tech/2016/12/09/jquery-isemptyobject/</link><guid isPermaLink="true">https://changyuhao625.github.io/tech/2016/12/09/jquery-isemptyobject/</guid><description>jQuery $.isEmptyObject 只能用在「單純的 JavaScript 物件」，對 boolean、number、null 會誤判為空；建議改用 $.isPlainObject 先確認是否為簡單物件再判斷，本文提供在 Chrome 實測 boolean/number/float/string/null/{}/{a:&quot;&quot;} 的結果。</description><pubDate>Fri, 09 Dec 2016 00:00:00 GMT</pubDate><category>jQuery</category><category>JavaScript</category><category>isEmptyObject</category><category>isPlainObject</category><author>Harry Chang</author></item><item><title>[Asp.Net MVC] An item with the same key has already been added！</title><link>https://changyuhao625.github.io/tech/2016/11/15/model-binding-tips1/</link><guid isPermaLink="true">https://changyuhao625.github.io/tech/2016/11/15/model-binding-tips1/</guid><description>Asp.Net MVC 執行時出現「An item with the same key has already been added」+「System.Web.Mvc.DefaultModelBinder.BindProperty」錯誤，原因是 Model Binding 不區分大小寫：子類別的 Email 與父類 BaseModel 的 email 會被視為同一 key。</description><pubDate>Tue, 15 Nov 2016 00:00:00 GMT</pubDate><category>Asp.Net MVC</category><category>Model Binding</category><category>DefaultModelBinder</category><author>Harry Chang</author></item><item><title>[jQuery] 為何不能透過 ajax 直接下載檔案?</title><link>https://changyuhao625.github.io/tech/2016/11/03/jquery-download-file/</link><guid isPermaLink="true">https://changyuhao625.github.io/tech/2016/11/03/jquery-download-file/</guid><description>從兩個角度解釋為何不能用 jQuery ajax 下載檔案：ajax 本身僅支援 xml/json/script/html 等文字型態 dataType，並非為下載二進位檔而設計；此外瀏覽器基於安全考量會阻止 JavaScript 直接把資料寫入本機，避免惡意腳本任意下載檔案。</description><pubDate>Thu, 03 Nov 2016 00:00:00 GMT</pubDate><category>jQuery</category><category>ajax</category><category>File Download</category><category>Browser Security</category><author>Harry Chang</author></item><item><title>[Asp.Net MVC] MVC 網站部署失敗</title><link>https://changyuhao625.github.io/tech/2016/11/02/iis-setting/</link><guid isPermaLink="true">https://changyuhao625.github.io/tech/2016/11/02/iis-setting/</guid><description>Asp.Net MVC 部署到舊版 IIS / Windows Server 2008 時出現 HTTP Error 403.14 Forbidden，暫時解法是在 web.config 的 system.webServer 加上 runAllManagedModulesForAllRequests=&quot;true&quot;；此設定會影響效能，建議改以升級伺服器或安裝補丁處理。</description><pubDate>Wed, 02 Nov 2016 00:00:00 GMT</pubDate><category>Asp.Net MVC</category><category>IIS</category><category>Windows Server</category><category>Deployment</category><author>Harry Chang</author></item><item><title>[Asp.Net] 檔案上傳長度限制</title><link>https://changyuhao625.github.io/tech/2016/11/01/file-size-limitation/</link><guid isPermaLink="true">https://changyuhao625.github.io/tech/2016/11/01/file-size-limitation/</guid><description>Asp.Net 預設單次 HttpRequest 上限 4096 KB，超過會拋 HttpException「超出最大的要求長度」；可在 web.config 的 httpRuntime 調整 maxRequestLength、requestLengthDiskThreshold 與 executionTimeout 三個參數解除限制。</description><pubDate>Tue, 01 Nov 2016 00:00:00 GMT</pubDate><category>Asp.Net</category><category>web.config</category><category>Upload</category><category>httpRuntime</category><author>Harry Chang</author></item><item><title>[jQuery] event.preventDefault() 與 event.stopPropagation() 的差異</title><link>https://changyuhao625.github.io/tech/2016/09/10/different-between-prevent-default-and-stop-propagation/</link><guid isPermaLink="true">https://changyuhao625.github.io/tech/2016/09/10/different-between-prevent-default-and-stop-propagation/</guid><description>比較 event.preventDefault() 與 event.stopPropagation() 的差異：前者終止元素的預設行為（例如超連結自動導頁），後者終止事件往父層元素傳導（冒泡）；jQuery 使用 return false 會一次同時觸發兩者。</description><pubDate>Sat, 10 Sep 2016 00:00:00 GMT</pubDate><category>jQuery</category><category>JavaScript</category><category>Event</category><author>Harry Chang</author></item><item><title>[VS] 建置後的事件!</title><link>https://changyuhao625.github.io/tech/2016/08/25/visual-studio-build-event/</link><guid isPermaLink="true">https://changyuhao625.github.io/tech/2016/08/25/visual-studio-build-event/</guid><description>Visual Studio 專案屬性「建置事件」頁籤可在建置前/後自動執行 cmd，例如以 call &quot;$(ProjectDir)AfterCompile\xxx.cmd&quot; 搬移產出的 dll，避免手動操作遺漏；但 cmd 若等待使用者輸入會造成建置失敗。</description><pubDate>Thu, 25 Aug 2016 00:00:00 GMT</pubDate><category>VS</category><category>Visual Studio</category><category>Build Event</category><category>cmd</category><author>Harry Chang</author></item><item><title>[SMTP] 郵件主旨亂碼！</title><link>https://changyuhao625.github.io/tech/2016/08/08/csharp-mail-subject-garbled/</link><guid isPermaLink="true">https://changyuhao625.github.io/tech/2016/08/08/csharp-mail-subject-garbled/</guid><description>針對 .Net Framework 4 郵件主旨含非 ASCII 字元且 UTF-8 編碼超過 41 bytes 會被重複 Encode 兩次導致亂碼的 Bug，示範不升級的解法：先把主旨 Convert.ToBase64String，再以 =?utf-8?B?{content}?= 格式指派給 MailMessage.Subject。</description><pubDate>Mon, 08 Aug 2016 00:00:00 GMT</pubDate><category>C#</category><category>SMTP</category><category>MailMessage</category><category>.Net Framework 4</category><category>Base64</category><author>Harry Chang</author></item><item><title>[LINQ] 增加可讀性的好寫法!</title><link>https://changyuhao625.github.io/tech/2016/08/03/csharp-linq-tips/</link><guid isPermaLink="true">https://changyuhao625.github.io/tech/2016/08/03/csharp-linq-tips/</guid><description>Code Review 案例：同仁原本用雙層 foreach 判斷 HandleWays 是否包含 CaseHandles，可改用一行 LINQ（from/where/Contains）或 Lambda（HandleWays.Where(d =&gt; CaseHandles.Contains(d))）大幅提升可讀性。</description><pubDate>Wed, 03 Aug 2016 00:00:00 GMT</pubDate><category>C#</category><category>LINQ</category><category>Lambda</category><category>Code Review</category><author>Harry Chang</author></item><item><title>[jQuery] Global Ajax Event Handlers</title><link>https://changyuhao625.github.io/tech/2016/07/25/jquery-global-event-handler/</link><guid isPermaLink="true">https://changyuhao625.github.io/tech/2016/07/25/jquery-global-event-handler/</guid><description>jQuery 提供 ajaxStart、ajaxSend、ajaxSuccess、ajaxError、ajaxComplete、ajaxStop 六個 Global Ajax Event Handlers，可把 blockUI / unblockUI 等共用邏輯集中處理，達到關注點分離，不必每次 $.ajax 都重複撰寫。</description><pubDate>Mon, 25 Jul 2016 00:00:00 GMT</pubDate><category>jQuery</category><category>Ajax</category><category>blockUI</category><author>Harry Chang</author></item><item><title>[NHibernate] Session Update 奇怪的寫法</title><link>https://changyuhao625.github.io/tech/2016/07/12/nhibernate-session-update/</link><guid isPermaLink="true">https://changyuhao625.github.io/tech/2016/07/12/nhibernate-session-update/</guid><description>NHibernate 會自動監控透過 Session.Get 載入的實體，異動屬性後只要 Session.Flush 就會同步到資料表；因此同仁程式碼中額外呼叫的 Session.Update 其實是多餘的寫法。</description><pubDate>Tue, 12 Jul 2016 00:00:00 GMT</pubDate><category>NHibernate</category><category>Session</category><category>Code Review</category><author>Harry Chang</author></item><item><title>[Spring.Net] Aop NHibernate Transaction失效了！</title><link>https://changyuhao625.github.io/tech/2016/07/12/nhibernate-aop-config-setting/</link><guid isPermaLink="true">https://changyuhao625.github.io/tech/2016/07/12/nhibernate-aop-config-setting/</guid><description>排查 Spring.Net AOP 造成 NHibernate Transaction 失效、物件沒有被掛上 Proxy 的問題：SdkRegularExpressionMethodPointcut 設定多個 pattern 時需改用 patterns 搭配 list，否則只有最後一條規則會生效。</description><pubDate>Tue, 12 Jul 2016 00:00:00 GMT</pubDate><category>Spring.Net</category><category>NHibernate</category><category>AOP</category><category>Transaction</category><author>Harry Chang</author></item><item><title>[Asp .Net MVC] ViewMode vs DTO(Data Transfer Object)</title><link>https://changyuhao625.github.io/tech/2016/06/14/different-between-view-model-and-data-transfer-object/</link><guid isPermaLink="true">https://changyuhao625.github.io/tech/2016/06/14/different-between-view-model-and-data-transfer-object/</guid><description>ViewModel 是帶有狀態與行為（如 Required、EmailAddress 等 Data Annotation 驗證）的 POCO；DTO 則是純資料搬運物件，不包含行為。分開兩者可避免 View 變動時牽動商業邏輯層與資料存取層，降低耦合。</description><pubDate>Tue, 14 Jun 2016 00:00:00 GMT</pubDate><category>View Model</category><category>DTO</category><category>POCO</category><category>Asp .Net MVC</category><category>Data Annotation</category><author>Harry Chang</author></item><item><title>[Asp .Net MVC] 淺談MVC系統架構</title><link>https://changyuhao625.github.io/tech/2016/06/08/mvc-architecture/</link><guid isPermaLink="true">https://changyuhao625.github.io/tech/2016/06/08/mvc-architecture/</guid><description>整理 Asp.Net MVC 分層架構：Controller 接到 ViewModel 後，應透過 AutoMapper 轉成 DTO 或 Entity 再進入商業邏輯層與資料存取層，避免 ViewModel 污染 Service 層，換 View 或做單元測試時都能更容易。</description><pubDate>Wed, 08 Jun 2016 00:00:00 GMT</pubDate><category>Asp .Net MVC</category><category>Architecture</category><category>ViewModel</category><category>DTO</category><category>AutoMapper</category><author>Harry Chang</author></item><item><title>[Asp .Net MVC] 使用ValidateAntiForgeryToken FilterAttribute 防範CSRF攻擊!</title><link>https://changyuhao625.github.io/tech/2016/05/05/asp-net-csrf-antiforgerytoken/</link><guid isPermaLink="true">https://changyuhao625.github.io/tech/2016/05/05/asp-net-csrf-antiforgerytoken/</guid><description>說明如何在 Asp.Net MVC 以 @Html.AntiForgeryToken 搭配 [ValidateAntiForgeryToken] FilterAttribute 防範 CSRF；並示範改用 jQuery $.ajax 時，如何把 __RequestVerificationToken 帶進 data 中通過防偽基元驗證。</description><pubDate>Thu, 05 May 2016 00:00:00 GMT</pubDate><category>Asp .Net MVC</category><category>CSRF</category><category>AntiForgeryToken</category><category>Security</category><category>jQuery</category><author>Harry Chang</author></item><item><title>[Asp .Net MVC] Ajax.BeginForm 與 unobtrusive AJAX</title><link>https://changyuhao625.github.io/tech/2016/04/30/asp-net-mvc-ajax-helper/</link><guid isPermaLink="true">https://changyuhao625.github.io/tech/2016/04/30/asp-net-mvc-ajax-helper/</guid><description>Asp.Net MVC 的 AjaxHelper 透過 Ajax.BeginForm 產生帶 data-ajax 屬性的表單，但瀏覽器仍會走一般 Form Submit；需安裝 NuGet 的 unobtrusive AJAX 套件引用 jquery.unobtrusive-ajax.js，才會偵測屬性並改以 Ajax 送出。</description><pubDate>Sat, 30 Apr 2016 00:00:00 GMT</pubDate><category>Asp .Net MVC</category><category>AjaxHelper</category><category>unobtrusive AJAX</category><category>jQuery</category><author>Harry Chang</author></item><item><title>[C#] 擴充方法(Extension Methods)!</title><link>https://changyuhao625.github.io/tech/2016/04/13/csharp-extension-methods/</link><guid isPermaLink="true">https://changyuhao625.github.io/tech/2016/04/13/csharp-extension-methods/</guid><description>介紹 C# 3.0 擴充方法 (Extension Methods) 的用途與寫法：以 static 方法加上 this 關鍵字即可為 String 等原生類別擴充新方法，例如把 int.TryParse 封裝成 &quot;12345&quot;.ToInt()，讓常用轉換寫起來更簡潔。</description><pubDate>Wed, 13 Apr 2016 00:00:00 GMT</pubDate><category>C#</category><category>Extension Methods</category><category>C# 3.0</category><author>Harry Chang</author></item><item><title>[Asp .Net MVC] ActionLink 頁面跳轉異常的問題</title><link>https://changyuhao625.github.io/tech/2016/04/13/mvc-actionlink-error/</link><guid isPermaLink="true">https://changyuhao625.github.io/tech/2016/04/13/mvc-actionlink-error/</guid><description>Asp.Net MVC 使用 @Html.ActionLink 若專案切割了 Area，產生的連結會被自動加上 Area Name 並不斷疊加，最終造成 Routing 失敗；解法是傳入 area = string.Empty 強制清空 Area 路由參數。</description><pubDate>Wed, 13 Apr 2016 00:00:00 GMT</pubDate><category>Asp .Net MVC</category><category>HtmlHelper</category><category>Area</category><category>Routing</category><author>Harry Chang</author></item></channel></rss>