有一份專案近期想轉移原本的主機系統,但把專案移至他台電腦測試發佈卻失敗,想請問是哪個地方需做修改呢

首頁是哪個檔案?比如 test.aspx
那你在Default.aspx.cs 裡做個
Response.Redirect("test.aspx");
轉址過去就好了
不好意思檔案是放在Views/Home/index.cshtml這樣也是直接導進去嗎
不知是不是這樣
放在load裡就對了

我這邊導向不過去耶
index不是資料夾吧?那你應該寫
Rsponse.Redirect("Hone/index.aspx");
是index.cshtml耶
一樣自己改一下....
Response.Redirect("Home/index.cshtml");
有的我剛試過了一樣導不過去耶![]()
怎麼覺得你的 cs 碼跟我的不一樣?把Default.aspx刪除,重新新增,內容不要改,直接在Page_Load裡加redirect....

我刪掉重改過了但問題跑到與一開始一樣
iis express 設定條件跟iis7/8/9不太一樣...
先確定一下你的主頁是放哪個資料夾下的哪個檔案
目前確定是放在Views/Home/index裡面
Views/Home/index裡的哪個網頁檔??

找到你網頁專案的根目錄裡的web.config檔,加入cshtml檔的支援
內容應該跟下方有點不同,但你找一下應有個 webpages:Enabled 的 value 看看是不是"true",如果不是,請改成true
<appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
    <add key="webpages:Version" value="2.0.0.0" />
    <add key="webpages:Enabled" value="false" />  <-- 這行,請改成true
    <add key="PreserveLoginUrl" value="true" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
  </appSettings>
                    謝謝,我把它改true了但問題還是一樣呦![]()
1、找到你電腦上的applicationhost.config檔,一般是放在你的網頁專案本地資料夾中的 .vs/config 裡
2、用文字編輯器(建議裝vscode,好用+1,免費的)打開這個applicationhost.config檔,找到你的網站設定,如
 <site name="G4.Admin(1)" id="8">
                <application path="/" applicationPool="Clr4IntegratedAppPool">
                    <virtualDirectory path="/" physicalPath="C:\Projetos\PortalG4\src\G4.Admin" />
                    <virtualDirectory path="/Offices/Edit" physicalPath="C:\Projetos\PortalG4\src" />
                    <virtualDirectory path="/Offices" physicalPath="C:\Projetos\PortalG4" />
                </application>
                <application path="/Offices/Edit/2" applicationPool="Clr4IntegratedAppPool">
                    <virtualDirectory path="/" physicalPath="C:\Projetos\PortalG4\src\G4.Admin" />
                </application>
                <bindings>
                    <binding protocol="http" bindingInformation="*:6920:localhost" />
                </bindings>
            </site>
3、上面那串設定,刪掉(記得把這個config檔備份後再刪那段設定文字),存檔,用VS再開專案再按F5進DEBUG
感謝,還是失敗![]()
好吧,iis.express對cshtml的支援真的是讓人無語
試一下這篇
https://rayrrr.blogspot.com/2020/04/aspnet-mvc-mvc.html