Asp.net MVC4 - 内部服务器500错误 - 仅在发布时

时间:2022-11-24 08:31:18

Just finished up my first mvc4 app. Everything is working great until I deploy it and I get: 500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed. every time I try to call /Account/Register or /Account/Login controllers:

刚刚完成我的第一个mvc4应用程序。一切都很好,直到我部署它,我得到:500 - 内部服务器错误。您正在查找的资源存在问题,无法显示。每次我尝试呼叫/帐户/注册或/帐户/登录控制器:

I've snooped around in firefox console and fiddler. I didn't find anything useful there, but then again I don't really know what I should even be looking for.

我在firefox控制台和小提琴手里偷偷摸摸。我没有找到任何有用的东西,但是我再也不知道我应该寻找什么。

Some other posts say to check the server log but that's a problem in itself because when I try to download, move, view, or delete the latest log file I get errors like "file transfer failed", "550 cant access file", "500 failed to delete file".

其他一些帖子说检查服务器日志,但这本身就是一个问题,因为当我尝试下载,移动,查看或删除最新的日志文件时,我收到“文件传输失败”,“550无法访问文件”,“ 500无法删除文件“。

I don't know what else to do, some please advice. Heres some code for call to Login controller. I won't post Register version since they seem related.

我不知道还能做什么,有些请指教。下面是一些用于调用Login控制器的代码。我不会发布注册版本,因为它们似乎相关。

Ajax call:

$.ajax({
                    url: "/Account/Login",
                    type: "POST",
                    data: $('#loginForm').serialize(),
                    success: function (resultData) {
                        if (resultData.ok) {
                            ...unrelated stuff...has call to resultData.message
                        }
                    }
                });

Login controller:

    [AllowAnonymous]
    [HttpPost]
    public ActionResult Login(LoginModel model)
    {

        if (ModelState.IsValid)
        {
            if (Membership.ValidateUser(model.UserName, model.Password))
            {
                FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);
                return Json(new { ok = true, message = "Login successful." });
            }
            else
            {
                return Json(new { ok = false, message = "The username or password you entered is invalid. Please try again." });
            }
        }

        // If we got this far, something failed, redisplay form
        return View(model);
    }

It all seems pretty standard here so I really don't know what it could be or how to even diagnose

这一切似乎都非常标准,所以我真的不知道它可能是什么或甚至如何诊断

1 个解决方案

#1


4  

I ran into a similar issue, which was a result of certain referenced DLLs not being present in the GAC of the server (only on the dev machine with the MVC4 beta installed). The solution was to set those dependencies to "Copy to Local" before compilation

我遇到了类似的问题,这是由于某些引用的DLL不存在于服务器的GAC中(仅在安装了MVC4 beta的开发机器上)。解决方案是在编译之前将这些依赖项设置为“Copy to Local”

* System.Web.Mvc
* System.Web.Routing
* System.Web.Abstractions
* Microsoft.Web.Infrastructure
* System.Web.Razor
* System.Web.WebPages.Deployment
* System.Web.WebPages.Razor

If you're having the same problem these links will help you solve it:

如果您遇到同样的问题,这些链接将帮助您解决问题:

Could not load file or assembly 'System.Web.Mvc'

无法加载文件或程序集'System.Web.Mvc'

http://haacked.com/archive/2008/11/03/bin-deploy-aspnetmvc.aspx

#1


4  

I ran into a similar issue, which was a result of certain referenced DLLs not being present in the GAC of the server (only on the dev machine with the MVC4 beta installed). The solution was to set those dependencies to "Copy to Local" before compilation

我遇到了类似的问题,这是由于某些引用的DLL不存在于服务器的GAC中(仅在安装了MVC4 beta的开发机器上)。解决方案是在编译之前将这些依赖项设置为“Copy to Local”

* System.Web.Mvc
* System.Web.Routing
* System.Web.Abstractions
* Microsoft.Web.Infrastructure
* System.Web.Razor
* System.Web.WebPages.Deployment
* System.Web.WebPages.Razor

If you're having the same problem these links will help you solve it:

如果您遇到同样的问题,这些链接将帮助您解决问题:

Could not load file or assembly 'System.Web.Mvc'

无法加载文件或程序集'System.Web.Mvc'

http://haacked.com/archive/2008/11/03/bin-deploy-aspnetmvc.aspx