You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The root cause of the issue is that IIS doesn't always clean up shadow copy folders with Microsoft.Data.SqlClient.DLL when a new version of web app is deployed.
E.g. IIS copies Microsoft.Data.SqlClient.DLL into C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\<app_name>\a782057e\5e070cea\assembly\dl3\747cbe86\00116ed2_b55cd701\Microsoft.Data.SqlClient.DLL during the first deployment. When the next deployment happens and IIS put Microsoft.Data.SqlClient.DLL into C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\<app_name>\a782057e\5e070cea\assembly\dl3\747cbe86\0055c85d_f61dd801\Microsoft.Data.SqlClient.DLL, the code below will find all folders with Microsoft.Data.SqlClient.DLL in them and, if the old folder is the first in the list, it will see that Microsoft.Data.SqlClient.SNI.x64.dll already exists there and will exit without copying the file. This is because 00116ed2_b55cd701 precedes 0055c85d_f61dd801 in the list. As a result, Microsoft.Data.SqlClient.DLL loads Microsoft.Data.SqlClient.SNI.x64.dll from the web app folder and IIS locks the file.
The root cause of the issue is that IIS doesn't always clean up shadow copy folders with
Microsoft.Data.SqlClient.DLL
when a new version of web app is deployed.E.g. IIS copies
Microsoft.Data.SqlClient.DLL
intoC:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\<app_name>\a782057e\5e070cea\assembly\dl3\747cbe86\00116ed2_b55cd701\Microsoft.Data.SqlClient.DLL
during the first deployment. When the next deployment happens and IIS putMicrosoft.Data.SqlClient.DLL
intoC:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\<app_name>\a782057e\5e070cea\assembly\dl3\747cbe86\0055c85d_f61dd801\Microsoft.Data.SqlClient.DLL
, the code below will find all folders withMicrosoft.Data.SqlClient.DLL
in them and, if the old folder is the first in the list, it will see thatMicrosoft.Data.SqlClient.SNI.x64.dll
already exists there and will exit without copying the file. This is because00116ed2_b55cd701
precedes0055c85d_f61dd801
in the list. As a result,Microsoft.Data.SqlClient.DLL
loadsMicrosoft.Data.SqlClient.SNI.x64.dll
from the web app folder and IIS locks the file.I had to modify that code to find the most recent shadow copy folder like this.
This issue didn't reproduce on my development machine but it was reproducing in prod-like environment quite often.
The text was updated successfully, but these errors were encountered: