将 MVC 3 应用程序部署到 IIS 7 时索引页面加载正常,但当我选择菜单项 404 错误时弹出
我已将我的 MVC 3 应用程序 BIN 部署到我的本地 IIS7 服务器。它在 Visual Basic 中运行良好。但在 IIS 7 中,只能访问我的视图的索引页。如果我选择任何菜单项,它会抛出此错误:
“/”应用程序中的服务器错误
找不到资源
描述:HTTP 404。您正在查找的资源(或其依赖项之一)可能已被删除,名称已更改,或者暂时不可用。请检查以下 URL 并确保拼写正确。
请求的 URL:/Admin/import_excel.vbhtml
版本信息:Microsoft.NET Framework 版本 4.0.30319; ASP.NET 版本 4.0.30319.237
下面是正在使用的路由表的副本...
Public Class MvcApplication
Inherits System.Web.HttpApplication
Shared Sub RegisterGlobalFilters(ByVal filters As GlobalFilterCollection)
filters.Add(New HandleErrorAttribute())
End Sub
Shared Sub RegisterRoutes(ByVal routes As RouteCollection)
routes.IgnoreRoute("{resource}.axd/{*pathInfo}")
' MapRoute takes the following parameters, in order:
' (1) Route name
' (2) URL with parameters
' (3) Parameter defaults
routes.MapRoute( _
"Default", _
"{controller}/{action}/{id}", _
New With {.controller = "Home", .action = "Index", .id = UrlParameter.Optional} _
)
End Sub
Sub Application_Start()
AreaRegistration.RegisterAllAreas()
RegisterGlobalFilters(GlobalFilters.Filters)
RegisterRoutes(RouteTable.Routes)
End Sub
End Class
任何人都知道我可能在哪里出错???
I have BIN deployed my MVC 3 application to my local IIS7 server. It runs fine in Visual Basic. But in IIS 7 only the index pages for my views are accessible. If I select any menu item it throws this error:
Server Error in '/' 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 unavalible. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /Admin/import_excel.vbhtml
Version Information: Microsoft.NET Framework Version 4.0.30319; ASP.NET Version 4.0.30319.237
Below is a copy of the routing table that is being used as well....
Public Class MvcApplication
Inherits System.Web.HttpApplication
Shared Sub RegisterGlobalFilters(ByVal filters As GlobalFilterCollection)
filters.Add(New HandleErrorAttribute())
End Sub
Shared Sub RegisterRoutes(ByVal routes As RouteCollection)
routes.IgnoreRoute("{resource}.axd/{*pathInfo}")
' MapRoute takes the following parameters, in order:
' (1) Route name
' (2) URL with parameters
' (3) Parameter defaults
routes.MapRoute( _
"Default", _
"{controller}/{action}/{id}", _
New With {.controller = "Home", .action = "Index", .id = UrlParameter.Optional} _
)
End Sub
Sub Application_Start()
AreaRegistration.RegisterAllAreas()
RegisterGlobalFilters(GlobalFilters.Filters)
RegisterRoutes(RouteTable.Routes)
End Sub
End Class
Anyone know where I might be going wrong at?????
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
找出问题所在...我遇到了 Microsoft.ACE 未在服务器计算机上注册的问题。我在论坛上发现一个帖子说将目标CPU更改为x86。后来我发现我只需要下载 ace 数据程序集,但从未将目标 CPU 改回 ANY。改回来后,我重新编译并再次部署它,没有任何问题......尽管我仍然不明白为什么这只会在某些页面上导致 404,而不是全部......
figured out what was wrong... I had a problem with Microsoft.ACE not being registered on the server machine. I found a thread in a forum that said to change the Target Cpu to x86. Later I found that I just needed to download the ace data assemblies but never changed the Target CPU back to ANY. After changing it back I recompiled and deployed it again with no problems... Although I am still lost as to why this would cause only 404's on some pages and not all....