部署时出现ASP.NET错误

时间:2014-03-03 06:57:05

标签: asp.net asp.net-mvc iis

我将我的项目发布到我的iis服务器,当我尝试访问该网站时,我收到以下错误:

The view 'Login' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Account/Login.aspx
~/Views/Account/Login.ascx
~/Views/Shared/Login.aspx
~/Views/Shared/Login.ascx
~/Views/Account/Login.cshtml
~/Views/Account/Login.vbhtml
~/Views/Shared/Login.cshtml
~/Views/Shared/Login.vbhtml

但是我知道login.cshtml位于它正在寻找的位置,当我在我的电脑上调试时,它运行得很好。

为了让它在iis服务器上运行,可能会发生什么变化或需要更改什么?

我只能想到,或许有些人如何将链接的~部分与错误的目录混淆了?

这是堆栈stace:

[InvalidOperationException: The view 'Login' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Account/Login.aspx
~/Views/Account/Login.ascx
~/Views/Shared/Login.aspx
~/Views/Shared/Login.ascx
~/Views/Account/Login.cshtml
~/Views/Account/Login.vbhtml
~/Views/Shared/Login.cshtml
~/Views/Shared/Login.vbhtml]
   System.Web.Mvc.ViewResult.FindView(ControllerContext context) +422
   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +147
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +109
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +890
  System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +97
   System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +241
   System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +111
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +19
   System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +51
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +111
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288

以下是我的网站directoy中的文件:

enter image description here

    /
    // GET: /Account/Login
    [AllowAnonymous]
    public ActionResult Login(string returnUrl)
    {
        ViewBag.ReturnUrl = returnUrl;
        if (User.Identity.IsAuthenticated)
        {
            return View("PermissionsError");
        }
        else
        {
            return View();
        }
    }

1 个答案:

答案 0 :(得分:0)

将视图的"Build Action"设置为"Content"并再次发布