Asp.net ASP Net MVC,服务器错误在'/';应用程序-找不到资源

Asp.net ASP Net MVC,服务器错误在'/';应用程序-找不到资源,asp.net,asp.net-mvc-4,Asp.net,Asp.net Mvc 4,我当前在尝试访问视图时遇到错误“找不到资源” 我试图打开的视图称为“注册”。 控制器(AccountController)实现了ActionResult方法“Register” 同一控制器包含一个“登录”视图,我可以毫无问题地访问该视图 我正在尝试调用的URL: localhost:port/Account/Login model.UserName,新的{htmlAttributes= 新建{@class=“form control”}) @Html.ValidationMessageFor(m

我当前在尝试访问视图时遇到错误“找不到资源”

我试图打开的视图称为“注册”。 控制器(AccountController)实现了ActionResult方法“Register”

同一控制器包含一个“登录”视图,我可以毫无问题地访问该视图

我正在尝试调用的URL:

localhost:port/Account/Login model.UserName,新的{htmlAttributes= 新建{@class=“form control”}) @Html.ValidationMessageFor(model=>model.UserName,“,new{@class=“text danger”}) @LabelFor(model=>model.Passwort,htmlAttributes:new{@class=“controllabel col-md-2”}) @EditorFor(model=>model.Passwort,new{htmlAttributes=new{@class=“form control”}}) @Html.ValidationMessageFor(model=>model.Passwort,“,new{@class=“text danger”})
您调用的方法似乎是POST-back,请尝试创建另一个方法,该方法将返回您所引用的视图。将此添加到代码中

 public ActionResult Register()
 {
    return View();
 }
视图的文件名与方法的名称相同。如果 不是,你也会犯同样的错误


有关路由的更多信息,请参阅Microsoft文档

谢谢!我没想到。。。修好了
@model MovieDatabase.Models.LoginModel

@{
ViewBag.Title = "Register";
}

<h2>Register</h2>


@using (Html.BeginForm())
{
@Html.AntiForgeryToken()

<div class="form-horizontal">
    <h4>LoginModel</h4>
    <hr />
    @Html.ValidationSummary(true, "", new { @class = "text-danger" })
    <div class="form-group">
        @Html.LabelFor(model => model.UserName, htmlAttributes: new { @class 
    = "control-label col-md-2" })
        <div class="col-md-10">
            @Html.EditorFor(model => model.UserName, new { htmlAttributes = 
    new { @class = "form-control" } })
            @Html.ValidationMessageFor(model => model.UserName, "", new { @class = "text-danger" })
        </div>
    </div>

    <div class="form-group">
        @Html.LabelFor(model => model.Passwort, htmlAttributes: new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            @Html.EditorFor(model => model.Passwort, new { htmlAttributes = new { @class = "form-control" } })
            @Html.ValidationMessageFor(model => model.Passwort, "", new { @class = "text-danger" })
        </div>
    </div>
    <div class="form-group">
        <div class="col-md-offset-2 col-md-10">
            <input type="submit" value="Register="btn btn-default" />
        </div>
    </div>
</div>
}
    @section Scripts {
         @Scripts.Render("~/bundles/jqueryval")
    } 
 public ActionResult Register()
 {
    return View();
 }