2012-08-23 114 views
0

大家好我想通过ISS7发布我的网站。我已经部署了所有必需的dll文件,但我得到了“无法找到资源”。你能帮我吗无法找到IIS 7资源MVC3

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

您使用的是内置在Visual Studio的Web开发服务器或已部署在本地主机上的应用ie iis? –

回答

0

一个.cshtml文件不应该被请求作为一个URL。

而是请求映射到控制器操作的路由(可能是呈现您尝试查找的.cshtml视图的路由)。

/WebCity /首页/指数

+0

那我该如何要求?你能举个例子吗? –

+0

@FurkanSönmez:我确实展示了一个例子。如果你正在请求一个相对URL,它可能会(根据你的路由配置)'/ WebCity/Home/Index'。如果您正在请求完全限定的URL(例如,如果您正在使用JavaScript进行Ajax回调),那么它将是“http:// mydomain.com/WebCity/Home/Index” –

0

如果在Global.ascx文件看,你会看到默认的路由设置像

routes.MapRoute(
       "default", 
       "{controller}/{action}/{id}", 
       new { action = "Index", id = "" } 
      )} 
      ); 

因此你的情况所请求的URL看起来像

/Home/Index 
     ^Controller Action 
^ Controller 

如果您的应用程序部署在本地主机那么它可能会像

http://localhost/Home 

http://localhost/Home/Index