Rider 偵錯 WSP 出現 virtual path maps to another application
修改 .sln ,把 Web Site Project 的虛擬路徑改成根路徑:
Debug.AspNetCompiler.VirtualPath = "/"
症狀
同一個方案在 Visual Studio 2022 偵錯正常,用 Rider 偵錯就報錯:
the virtual path maps to another application, which is not allowed
原因與處理
.sln 裡原本的設定帶有子路徑:
Debug.AspNetCompiler.VirtualPath = "/localhost_53574"
改成 "/" 之後 Rider 就能正常偵錯。這個設定是 Web Site Project(WSP)才有的;改用 Web Application Project 就不會遇到,可參考 WSP 轉 WAP。
參照
ASP.NET virtual path maps to another application which is not allowed (stackoverflow.com)
24 November 2026