我正在尝试将基本的Web应用程序从Windows 7上的visual studio上传到Windows Server 2007上的IIS环境。
虽然从IIS启动它会显示“登录”页面,但尝试将其导航到主菜单会返回此错误:
Server Error in Application "PARKING/PARKING ASSIGNMENTS WEB"Internet Information Services 7.0
Error Summary
HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable. Detailed Error Information
Module IIS Web Core
Notification MapRequestHandler
Handler StaticFile
Error Code 0x80070002
Requested URL http://localhost:81/Parking Assignments Web/Home
Physical Path C:\ParkingAssignmentsWeb\Home
Logon Method Anonymous
Logon User Anonymous
Most likely causes:
•The directory or file specified does not exist on the Web server.
•The URL contains a typographical error.
•A custom filter or module, such as URLScan, restricts access to the file.
Things you can try:
•Create the content on the Web server.
•Review the browser URL.
•Create a tracing rule to track failed requests for this HTTP status code and see which module is calling SetStatus. For more information about creating a tracing rule for failed requests, click here.
Links and More InformationThis error means that the file or directory does not exist on the server. Create the file or directory and try the request again.
View more information »
这是我用于导航的代码:
Response.Redirect("Home.aspx");
为什么此导航在Visual Studio上有效但在IIS上无效?
更新:我尝试了你们向我展示的Redirect命令的变体,但是所有这些都给出了404错误,这让我相信问题不在于命令,而在于其他问题。知道什么吗?
答案 0 :(得分:0)
请尝试:
Response.Redirect("~/Parking Assignments Web/Home.aspx");
或
Response.Redirect("~/Parking Assignments Web/Home");
答案 1 :(得分:0)
它将Home.aspx
视为相对路径。
使用它像:
Response.Redirect("/Home.aspx");
答案 2 :(得分:0)
当您部署到IIS时,正在使用其他Web服务器。 Visual Studio使用的Web服务器选项有限,但在大多数情况下,并非所有应用程序在Windows服务器上部署到IIS时都应该无需更改即可运行。
要检查的事项