【发布时间】:2013-08-19 22:43:28
【问题描述】:
这是我第一次在 Amazon S3 服务器中部署 MVC Web 应用程序。 并且网站已加载到浏览器中,但是当我单击注册按钮时,它会抛出错误。 我可以看到唯一的区别是 我的应用程序命名为reporting.e-tale.co.uk,域设置为dashboard.e-tale.co.uk,所以我在live中创建了一个文件夹作为dashboard.e-tale.co.uk并复制了我的文件。它在本地工作正常不知道它抛出错误的原因。
如果我做错了什么,请纠正我。 我不确定要提供什么细节。如果难以提出解决方案,我将为您提供更多详细信息。 谢谢
“/”应用程序中的服务器错误。
对象引用未设置为对象的实例。
说明:在执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。
异常详细信息:System.NullReferenceException:对象引用未设置为对象的实例。
来源错误:
在执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常起源和位置的信息。
堆栈跟踪:
[NullReferenceException:对象引用未设置为对象的实例。]
报告.e_tale.co.uk.Controllers.AccountController.Register() +255
lambda_method(闭包,ControllerBase,对象[])+78
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) +263
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 参数) +38
System.Web.Mvc.c_DisplayClass15.b_12() +128
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter 过滤器,ActionExecutingContext preContext,Func1 continuation) +826106
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func1 续)+826106
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter 过滤器,ActionExecutingContext preContext,Func1 continuation) +826106
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList1 过滤器,ActionDescriptor actionDescriptor,IDictionary`2 参数)+314
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +825328
System.Web.Mvc.Controller.ExecuteCore() +159
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +335
System.Web.Mvc.c_DisplayClassb.b_5() +62
System.Web.Mvc.Async.c_DisplayClass1.b_0() +20
System.Web.Mvc.c_DisplayClasse.b_d() +54
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +469
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375
版本信息:Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.0.30319.1008
帐户控制器(注册)
/// <summary>
/// GET: /Account/Register
/// Action account Register.
/// </summary>
/// <returns></returns>
[AcceptVerbs(HttpVerbs.Get)]
public ActionResult Register()
{
var myViewData = new RegisterForm
{
Person = new Person
{
CreatedAt = DateTime.Now,
AppellationId =
_appellationRepository.GetAppellationByDescription(
"Mr").Id,
CountryId =
_countryRepository.GetCountryByName(
"United Kingdom").Id,
CorporationId = _corporationRepository.GetCorporationByName(
"Samsung").Id
//ManufacturerId = _manufacturerRepository.GetManufacturerByName(
//"Samsung").Id
},
User =
new User
{
CreatedAt = DateTime.Now,
Guid = Guid.NewGuid().ToString("N")
}
};
myViewData.Appellations = new SelectList(_appellationRepository.GetAllAppellations().ToList(), "Id",
"Description", myViewData.Person.AppellationId);
myViewData.Countries = new SelectList(_countryRepository.GetAllCountries().ToList(), "Id", "Name",
myViewData.Person.CountryId);
myViewData.Corporations = new SelectList(_corporationRepository.GetAllcorporations().ToList(), "Id",
"Description", myViewData.Person.CorporationId);
//myViewData.Manufacturers = new SelectList(_manufacturerRepository.GetAllManufacturers().ToList(),"Id",
// "Description",myViewData.Person.ManufacturerId);
myViewData.PasswordLength = MembershipService.MinPasswordLength;
return View(myViewData);
}
【问题讨论】:
-
请向我们显示错误或其他内容。我们怎么可能知道“但是有错误”的问题是什么?我们可以抛出随机建议,但除非您告诉我们错误是什么,否则这无济于事。
-
@SimonWhitehead 我在配置中设置了自定义错误,但出现错误。请看我编辑的帖子
-
您的代码有一个
null对象。向我们展示您的AccountController的Register()操作方法,我们可以帮助您进行诊断。这可能与数据有关..您的本地数据与预期的一样,但您的实时数据库缺少一些您期望在那里的数据。 -
@SimonWhitehead 请检查,我更新了我的操作
-
可能是因为错误比较明显。
NullReferenceException非常具有描述性……有些东西是null。它甚至告诉你它发生在什么方法上(这就是我知道的......从你的堆栈跟踪中)。
标签: c# asp.net-mvc-3 web-deployment setup-deployment