ASP.NET MVC Page Won't Load and says “The reso

2020-02-26 02:50发布

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.

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: /EventScheduler/account.aspx/login

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

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/

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.

20条回答
混吃等死
2楼-- · 2020-02-26 03:51

Upon hours of debugging, it was just an c# error in my html view. Check your view and track down any error

Don't comment c# code using html style ie

查看更多
smile是对你的礼貌
3楼-- · 2020-02-26 03:54

In my case, I needed to replace this:

@Html.ActionLink("Return license", "Licenses_Revoke", "Licenses", new { id = userLicense.Id }, null)

With this:

<a href="#" onclick="returnLicense(event)">Return license</a>

<script type="text/javascript">
    function returnLicense(e) {
        e.preventDefault();

        $.post('@Url.Action("Licenses_Revoke", "Licenses", new { id = Model.Customer.AspNetUser.UserLicenses.First().Id })', getAntiForgery())
            .done(function (res) {
                window.location.reload();
            });
    }
</script>

Even if I don't understand why. Suggestions are welcome!

查看更多
登录 后发表回答