NetCore 2、3 Deploy

環境 : 

net core 2.0 + jquery + Razor

net core 3.0 + angular + webapi

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1.IIS上,確認模組/ AspNetCoreModule、AspNetCoreModuleV2,(net core 2、3)

2.IIS 上先設定應用程式集區,新增一個 沒有Managed 程式碼,管線模式 : 整合。

3.先找尋net core version,Windows Hosting Bundle Installer,然download,裝完重開機

4.cmd 下,net stop was /y,停用World Wide Web Publishing 服務,net start w3svc,啟用World Wide Web Publishing 服務

5.利用project下的Publish功能 (小地方,怎麼驗證publish檔案是對的呢?  開啟cmd,至該publish路徑下,執行dotnet aspnetapp.dll ,開browser,輸入launchSettings\iisExpress\applicationUrl,即可)

6.502.5 Error ,查詢publish下的webconfig,也看一下windows記錄\應用程式,來源IIS AspNetCore Module,設定dotnet 使用app.dll的位置問題

7.appSettings,build、deploy時,不會自動,需於該檔案下/屬性/進階/建置動作:內容、複製到輸出目錄:有更新時才複制

http://rocksaying.tw/archives/2019/dotNET-Core-%E7%AD%86%E8%A8%98-ASP.NET-Core-appsettings.json-%E8%88%87%E5%9F%B7%E8%A1%8C%E7%92%B0%E5%A2%83.html

8.wwwroot,使用到js、css時,會找尋wwwroot (jquery)

9.vscode ng build , deploy dist folder, copy ClientApp/Dist To deploy path (angular)

https://blog.johnwu.cc/article/ironman-day16-asp-net-core-multiple-environments.html

1.System.Security.Cryptography.CryptographicException: The key {} was not found in the key ring

solution : key產生於 c :\ windows\system32\inetsrv\config\applicationHost.config,setProfileEnvironment 屬性設為true

https://docs.microsoft.com/zh-tw/aspnet/core/host-and-deploy/iis/?view=aspnetcore-3.1#data-protection : 設定 IIS 應用程式集區載入使用者設定檔

2. https://stackoverflow.com/questions/55985972/i-cant-connect-to-sql-server-by-2017-by-dapper-1-60-6

ref : 

https://docs.microsoft.com/zh-tw/aspnet/core/tutorials/publish-to-iis?view=aspnetcore-3.1&tabs=visual-studio

https://blog.johnwu.cc/article/iis-run-asp-net-core.html

https://dotblogs.com.tw/shadow/2019/01/24/173353

https://dotblogs.com.tw/wasichris/2018/11/01/204531

https://docs.microsoft.com/zh-tw/aspnet/core/security/data-protection/configuration/default-settings?view=aspnetcore-3.1

ssl : https://blog.johnwu.cc/article/asp-net-core-enforcing-ssl.html