搬移專題的程式碼到主機
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
【TL;DR】
- 先把前端編譯後的頁面,放到後端的資料夾裡面
- 如果整份放到站台開得起來,大概有八成機率算成功(?)
- 成功後就整組再搬進教室的主機裡面
- 假如在主機裡面也能成功運作,就再找教練綁定網域
環境準備
-
【目標】:
- 在本機端架設
IIS
站台
- 並能連線到
SSMS
的資料庫
-
裝置:
- 用自己的電腦
- 或是用
AZURE
雲端的虛擬機
- (只要有不同的手機、信用卡就可以再開新的免費帳號)
補充
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
- 可以先順便檢查
Swagger
、API
有沒有正常
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
前端部分
1_更改程式碼
- 分為
HashRouter
與 BrowserRouter
版本
<HashRouter>
main.jsx
裡面記得使用 <HashRouter>
vite.config.js
API
- 由於前後端的檔案目錄已經統整,所以要更改當初設定的
BASE_URL
為 './'
<BrowserRouter>
- 假如採用的是
<BrowserRouter>
,需額外加上 rewrite
、Web.config
設定
【可參考 Alice 整理的】:
【Stackoverflow】:
…後續就交給勇者測試惹
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
2_產生編譯檔案
- 下指令
- 會在目錄生出
<dist>
的資料夾
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
- 就把整個
<dist>
資料夾壓縮起來,傳給後端ㄅ
後端更改程式碼
- 把前端的編譯檔案,直接放在
app.publish
的目錄下
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
- 到
HomeController
,修改 return
- 重啟站台
其他方法
- 假如上述無效:
- 首頁還是原本預設的
ASP.NET
- 或是直接空白畫面QQ
- 回到
HomeController
- 移動到
app.publish\Views\Home
-
接著把前端編譯過的 index.html
內容全部複製過來貼在後面
-
最後,看起來會長得像這樣:
- 重啟站台