1. 程式人生 > >伺服器win2008server R2 x64 部署.net core到IIS 並解決ASP .NET Core HTTP Error 502.5 – Process Failure 的問題等

伺服器win2008server R2 x64 部署.net core到IIS 並解決ASP .NET Core HTTP Error 502.5 – Process Failure 的問題等

伺服器win2008server R2 x64 部署.net core到IIS

並解決ASP .NET Core HTTP Error 502.5 – Process Failure 的問題

1、釋出網站 ;
2、安裝 vc_redist.x64  (Visual C++ Redistributable for Visual Studio 2015) 新裝的系統沒裝的補丁,裝過略過;
3、安裝WindowsHosting :如: dotnet-hosting-2.1.3-win ;
4、安裝.Net Core SDK: 如:dotnet-sdk-2.1.401-win-x64 ;


   注意3,4版本要一致; https://www.microsoft.com/net/download/dotnet-core/2.1

 


5、重啟IIS伺服器,cmd 中輸入 iisreset.

6、新增netcore站點,應用程式池的.NET Framework版本選擇“無託管程式碼”:application pool應用池-> 高階 -> 標識 將原來ApplicationPoolIdentity改為對資料庫有訪問許可權和網站檔案有讀寫許可權的Windows使用者(這裡需要確定這個Windows使用者可以登入資料庫,不行可以在資料庫安全設定新增。當然你也可以將資料庫連線字元竄改為資料庫使用者和密碼訪問,比如:sa),然後重啟應用池,重啟網站瀏覽

 

7、 瀏覽程式
瀏覽程式報錯 1 :An error occurred while starting the application.
看不到詳細資訊需要修改web.config 檢視詳細資訊 將stdoutLogEnabled的修改為 true,並在應用程式根目錄新增 logs 資料夾<aspNetCore processPath="dotnet" arguments=". \tzky.saas.Web.Host.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />再瀏覽網站,當然還是報錯,現在到logs目錄檢視報錯詳細資訊


瀏覽程式報錯2:ASP .NET Core HTTP Error 502.5 – Process Failure

這個問題有兩個思路:
第一 : WindowsHosting 和 .Net Core SDK的版本不一致導致;重新注重安裝;
第二 :伺服器缺補丁;驗證 dotnet 是否能正常使用,在cmd中 進入 C:\Program Files\dotnet>dotnet --version


cmd 報錯3:提示 api ms win crt runtime 1-1-0.dll 丟失,dotnet 啟動程式失敗。 

 

安裝 vc_redist.x64  (Visual C++ Redistributable for Visual Studio 2015)  後還有錯誤:

Files\dotnet\host\fxr\1.0.1\hostfxr.dll], HRESULT: 0x8007007E】錯誤
ErrorCode = '0x80004005 : 80008082.
 KB2999226 微軟下載連結 https://support.microsoft.com/en-us/help/2999226/update-for-universal-c-runtime-in-windows
 KB3118401 微軟下載連結 https://support.microsoft.com/en-us/help/3118401/update-for-universal-c-runtime-in-windows

需要下載安裝KB2999226補丁程式 ,注意是win2008server R2 x64 版本的;

cmd 報錯4:Files\dotnet\host\fxr\1.0.1\hostfxr.dll], HRESULT: 0x80070057】錯誤

win2008server R2 x64 部署.net core到IIS上出現【Failed to load the dll from [C:\Program Files\dotnet\host\fxr\1.0.1\hostfxr.dll], HRESULT: 0x80070057】錯誤
解決方法: 需要安裝補丁:KB2533623 下載地址如下:https://support.microsoft.com/en-us/kb/2533623 需要重啟

 重啟後 用dotnet 命令在專案根目錄下直接執行你的Web程式,例如 dotnet xxxWeb.dll   正常啟動:

 

  最後祝君成功!

 

 

下以是伺服器win2008server R2 x64安裝包: NDP471-KB4033344-Web  是 .net framework 4.7.1

 

 

 

     

1、釋出網站 ;
2、安裝 vc_redist.x64  (Visual C++ Redistributable for Visual Studio 2015) 新裝的系統沒裝的補丁,裝過略過;
3、安裝WindowsHosting :如: dotnet-hosting-2.1.3-win ;
4、安裝.Net Core SDK: 如:dotnet-sdk-2.1.401-win-x64 ;
   注意3,4版本要一致; https://www.microsoft.com/net/download/dotnet-core/2.1

 


5、重啟IIS伺服器,cmd 中輸入 iisreset.

6、新增netcore站點,應用程式池的.NET Framework版本選擇“無託管程式碼”:application pool應用池-> 高階 -> 標識 將原來ApplicationPoolIdentity改為對資料庫有訪問許可權和網站檔案有讀寫許可權的Windows使用者(這裡需要確定這個Windows使用者可以登入資料庫,不行可以在資料庫安全設定新增。當然你也可以將資料庫連線字元竄改為資料庫使用者和密碼訪問,比如:sa),然後重啟應用池,重啟網站瀏覽

 

7、 瀏覽程式
瀏覽程式報錯 1 :An error occurred while starting the application.
看不到詳細資訊需要修改web.config 檢視詳細資訊 將stdoutLogEnabled的修改為 true,並在應用程式根目錄新增 logs 資料夾<aspNetCore processPath="dotnet" arguments=". \tzky.saas.Web.Host.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />再瀏覽網站,當然還是報錯,現在到logs目錄檢視報錯詳細資訊
瀏覽程式報錯2:ASP .NET Core HTTP Error 502.5 – Process Failure

這個問題有兩個思路:
第一 : WindowsHosting 和 .Net Core SDK的版本不一致導致;重新注重安裝;
第二 :伺服器缺補丁;驗證 dotnet 是否能正常使用,在cmd中 進入 C:\Program Files\dotnet>dotnet --version


cmd 報錯3:提示 api ms win crt runtime 1-1-0.dll 丟失,dotnet 啟動程式失敗。 

 

安裝 vc_redist.x64  (Visual C++ Redistributable for Visual Studio 2015)  後還有錯誤:

Files\dotnet\host\fxr\1.0.1\hostfxr.dll], HRESULT: 0x8007007E】錯誤
ErrorCode = '0x80004005 : 80008082.
 KB2999226 微軟下載連結 https://support.microsoft.com/en-us/help/2999226/update-for-universal-c-runtime-in-windows
 KB3118401 微軟下載連結 https://support.microsoft.com/en-us/help/3118401/update-for-universal-c-runtime-in-windows

需要下載安裝KB2999226補丁程式 ,注意是win2008server R2 x64 版本的;

cmd 報錯4:Files\dotnet\host\fxr\1.0.1\hostfxr.dll], HRESULT: 0x80070057】錯誤

win2008server R2 x64 部署.net core到IIS上出現【Failed to load the dll from [C:\Program Files\dotnet\host\fxr\1.0.1\hostfxr.dll], HRESULT: 0x80070057】錯誤
解決方法: 需要安裝補丁:KB2533623 下載地址如下:https://support.microsoft.com/en-us/kb/2533623 需要重啟

 重啟後 用dotnet 命令在專案根目錄下直接執行你的Web程式,例如 dotnet xxxWeb.dll   正常啟動:

 

  最後祝君成功!

 

 

下以是伺服器win2008server R2 x64安裝包: NDP471-KB4033344-Web  是 .net framework 4.7.1