2023年2月23日 星期四

[筆記] mio 5051 如何產製KML檔

 


用Google的 my map建置好地圖,接著再匯出成KML

https://www.google.com/maps/d/?hl=zh-TW






打開KML檔,把 <Document> 這層節點拿掉







2022年3月15日 星期二

[SQL] 找出執行時間最長的10條SQL

 

如果想對SQL作篩選,可將

not like '%fetch%'  換成  like '%user%'就可以找出SQL語句中含有user關鍵字的SQL

原文:

http://blog.csdn.net/silvanus/article/details/8424227


SELECT top 10
	(total_elapsed_time / execution_count)/1000 N'平均時間ms'
	,total_elapsed_time/1000 N'總花費時間ms'
	,total_worker_time/1000 N'所用的CPU總時間ms'
	,total_physical_reads N'物理讀取總次數'
	,total_logical_reads/execution_count N'每次邏輯讀次數'
	,total_logical_reads N'邏輯讀取總次數'
	,total_logical_writes N'邏輯寫入總次數'
	,execution_count N'執行次數'
	,creation_time N'語句編譯時間'
	,last_execution_time N'上次執行時間'
	,SUBSTRING(
		st.text, 
		(qs.statement_start_offset/2) + 1, 
		(
			(CASE statement_end_offset WHEN -1 THEN DATALENGTH(st.text) ELSE qs.statement_end_offset END - qs.statement_start_offset)/2
		) + 1
	) N'執行語句'
	,qp.query_plan
FROM
sys.dm_exec_query_stats AS qs CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) st CROSS APPLY sys.dm_exec_query_plan(qs.plan_handle) qp
WHERE
	SUBSTRING(
		st.text, 
		(qs.statement_start_offset/2) + 1,
		(
			(CASE statement_end_offset WHEN -1 THEN DATALENGTH(st.text) ELSE qs.statement_end_offset END - qs.statement_start_offset)/2
		) + 1
	) not like '%fetch%'
ORDER BY
	total_elapsed_time / execution_count DESC;










2022年3月14日 星期一

[.NET Core] 解決MVC網頁服務的dll常常被IIS咬住

 

在開發.Net Core MVC時,因為專案有多個web和api服務依附在iis上做運行,會需要邊跑網頁邊開發,因此常發生project編譯出來的dll被iis咬住,這時候就得手動重啟iis,但等IIS重啟實在太慢了


Severity Code Description Project File Line Suppression State

Error MSB3027 Could not copy "******\bin\Debug\net6.0\******.dll" to "bin\Debug\net6.0\*****.dll". Exceeded retry count of 10. Failed. The file is locked by: "IIS Worker Process (6404)" Company C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets\


無法將 "****\bin\Debug\net6.0\****.dll" 複製到 "bin\Debug\net6.0\****.dll"。已超過重試次數 10。失敗。檔案鎖定者: "w3wp.exe (6404)" Company C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets 4967


C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4967,5): error MSB3021: 無法將檔案 "****\bin\Debug\net6.0\****.dll" 複製到 "bin\Debug\net6.0\****.dll"。由於另一個處理序正在使用檔案 'bin\Debug\net6.0\****.dll',所以無法存取該檔案。





這邊提供比較快速的方法


1. 建立一個iisrestart1.bat批次執行檔

指令內容如下

C:\Windows\System32\inetsrv\appcmd.exe recycle apppool /apppool.name:"WebAPIPool"

C:\Windows\System32\inetsrv\appcmd.exe recycle apppool /apppool.name:"XXXwebPool"


2. 針對bat 批次檔建立捷徑,接著在捷徑的"內容"中調整"目標"值

C:\Windows\System32\cmd.exe /C "C:\Users\XXXX\Documents\iisrestart1.bat"




3. 釘選到工作列,即可完成



之後只要執行批次檔就可以快速釋放IIS  POOL,進而能順利做編譯,若在DEBUG模式下沒有反應時,則需整個重啟IIS或是砍掉w3wp執行緒



* 指令筆記:


//砍掉所有w3wp執行緒

taskkill /F /IM w3wp.exe /T


//回收指定的IIS Pool

C:\Windows\System32\inetsrv\appcmd.exe recycle apppool /apppool.name:"WebAPIPool"

C:\Windows\System32\inetsrv\appcmd.exe recycle apppool /apppool.name:"XXXwebPool"

2022年1月13日 星期四

[工具] WebService測試工具SoapUI

 

 關於使用SoapUI來測試WebService的筆記





貼上網址,後一定要加上 ?WSDL







 

<![CDATA[   ]]>包覆電文內容,但頭尾都不能換行哦


 






2021年12月21日 星期二

[.net] 檢查Server安裝.net 版本

 


檢查server上安裝的.net framework版本



cd C:\Windows\System32

dir %WINDIR%\Microsoft.Net\Framework\v* O-N /B




檢查server上安裝的.net core版本

dotnet --list-sdks




參考 https://docs.microsoft.com/zh-tw/dotnet/core/install/how-to-detect-installed-versions?pivots=os-windows



2021年9月1日 星期三

[MSSQL] 預存程序引用DLL參考



*在組件中加入DLL參考



*可將DLL檔案轉成bytes 直接加入參考



CREATE ASSEMBLY SQLCom

FROM 0x4D5A900003.................

WITH PERMISSION_SET = SAFE;



DLL to bytes string 參考

https://stackoverflow.com/questions/2885335/clr-sql-assembly-get-the-bytestream





 *DLL程式碼


    [Microsoft.SqlServer.Server.SqlFunction]

    public static string GZip(string rawString)

    {

       ..................

            return (string)(Convert.ToBase64String(zippedData));

    }








    * 於資料新增 擴充的 預存程序

    CREATE FUNCTION dbo.GZip(@src nvarchar(MAX))

    RETURNS nvarchar(MAX)

    EXTERNAL NAME SQLCom.UserDefinedFunctions.GZip





*SQL指令
    SELECT dbo.GZip(S_String)




2021年1月25日 星期一

[C#] 利用svcutil.exe下指令產生WCF client端的程式碼

 


在做異質系統間接時,若是透過WCF連線,此時專案就必須加入服務參考,但開發本機端若因為防火牆因素無法直接連到對方的WCF服務來取的服務參考,但目標機器又無法安裝VS2019開發工具,這時可在目標機器上安裝SDK,並利用svcutil.exe來下指令產生clinet端程式碼


以下兩道指令

svcutil.exe /t:metadata http://******/******/MsgService.svc

svcutil *.wsdl *.xsd /language:cs /out:MsgService.cs /config:app.config




2020年6月2日 星期二

[win10] 在Windows 10中以 系統管理員身分

擷取自:https://walker-a.com/archives/5966

參考:https://marcus116.blogspot.com/2018/12/how-to-run-visual-studio-as-administrator-by-default.html




方法:捷徑上指定系統管理員身分為預設的執行權限
在捷徑上按下滑鼠右鍵並選擇「內容」。

【捷徑】分頁畫面上按下〔進階〕。
在〔進階〕內容的畫面上勾選「以系統管理員身分執行」,並按下〔確定〕來離開。


如果出現以下拒絕存取的對話框,請點選〔繼續〕按鈕來完成。


你也可以使用【相容性】分頁上的「以系統管理員身分執行此程式」。

2020年1月3日 星期五

[windows] 控制win10更新時間或停止更新


參考 https://www.bnext.com.tw/article/48840/turn-down-win-10-update

為了掌控windows自動更新自動重開機,必須設定的



在搜尋框內輸入「編輯群組原則」
透過左側的目錄樹轉到「電腦設定 – 系統管理範本 - Windows 元件 - Windows Update」找到「設定自動更新」選項














2019年7月29日 星期一

[windows] 允許多人遠端磚面連線


轉自:https://is.gd/iA0dzF



預設情況下,同一個帳號,只能一個連線,如果建立新的連線,舊的連線會被斷線

以下是開放的方式:

執行 【gpedit.msc】



【電腦設定】->【系統管理範本】->【Windows元件】

>【遠端桌面服務】->【遠端桌面工作階段主機】->【連線】

在右邊的視窗,找到【限制遠端桌面服務的使用者只能使用一個遠端桌面服務工作階段】,預設是【尚未設定】

改成【已停用】




 

MangoHost Copyright © 2009 Cookiez is Designed by Ipietoon for Free Blogger Template