大家好我正试图通过ISS7发布我的网站。我已经部署了所有必需的dll文件但是我得到“无法找到资源”。你能帮帮我吗
Server Error in '/WebCity' Application.
--------------------------------------------------------------------------------
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /WebCity/Views/Home/Index.cshtml
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
答案 0 :(得分:0)
绝不应将.cshtml文件作为URL请求。
相反,请求一个映射到控制器操作的路径(可能是呈现您试图找到的.cshtml视图的路径),例如。
/ WebCity /家庭/索引
答案 1 :(得分:0)
如果查看Global.ascx
文件,您将看到默认路由设置,如
routes.MapRoute(
"default",
"{controller}/{action}/{id}",
new { action = "Index", id = "" }
)}
);
因此,您案例中请求的网址将如下所示
/Home/Index ^ Controller Action ^ Controller
如果您的应用程序部署在localhost,那么它可能看起来像
http://localhost/Home
或
http://localhost/Home/Index