ASP.NET MVC页面将无法加载,并显示“找不到资源". [英] ASP.NET MVC Page Won't Load and says "The resource cannot be found"

查看:409
本文介绍了ASP.NET MVC页面将无法加载,并显示“找不到资源".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试打开ASP.NET MVC应用程序时遇到问题,但出现ASP.NET错误页面,上面写着:

I am having a problem where I try to open my ASP.NET MVC application but I get the ASP.NET error page which says this:

"/"应用程序中的服务器错误.

Server Error in '/' Application.

找不到资源. 说明:HTTP404.您正在寻找的资源(或其依赖项之一)可能已被删除,名称更改或暂时不可用.请查看以下网址,并确保其拼写正确.

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.

请求的URL:/EventScheduler/account.aspx/login

Requested URL: /EventScheduler/account.aspx/login

版本信息:Microsoft .NET Framework版本:2.0.50727.3053; ASP.NET版本:2.0.50727.3053 **

Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053**

我正在使用此博客文章中的URL技巧,这就是为什么我在URL中使用.aspx的原因:

I am using the URL trick from this blog post and that is why I have the .aspx in the URL:

http://blog.codeville.net/2008/07/04/options-for-deploying-aspnet-mvc-to-iis-6/

它可以在我的其他沙箱服务器(不是开发机)上运行,现在我将它作为新的虚拟目录部署到了生产站点,但是由于某种原因,它似乎实际上是在寻找.aspx文件.

It works on my other sandbox server (not a dev machine), and now I just deployed it to my production site as a new virtual directory, but for some reason it seems like it's actually looking for a .aspx file.

有什么想法吗?我想我一定会忘记一步.

Any ideas? I think I must be forgetting a step.

推荐答案

我找到了解决此问题的方法,您不必删除global.asax,因为它包含一些有价值的信息,可以使您的proyect顺利运行,相反,请查看您控制器的名称,在我的情况下,我的控制器被命名为MyController.cs,在global.asax中它正在尝试引用Home Controller.

I found the solution for this problem, you don't have to delete the global.asax, as it contains some valuable info for your proyect to run smoothly, instead have a look at your controller's name, in my case, my controller was named something as MyController.cs and in the global.asax it's trying to reference a Home Controller.

在全局asax中查找此行

Look for this lines in the global asax

routes.MapRoute(
   "Default", // Route name
   "{controller}/{action}/{id}", // URL with parameters
   new { controller = "Home", action = "Index", id = UrlParameter.Optional } 

就我而言,我必须像这样工作

in my case i had to get like this to work

    new { controller = "My", action = "Index", id = UrlParameter.Optional }

这篇关于ASP.NET MVC页面将无法加载,并显示“找不到资源".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆