I have created a simple web site using ASP.Net MVC 4, Internet Application. I added a controller, model and associated views for a new page. Everything works fine running locally, I can register, login and use my new page functionality. After publishing to Azure website I can successfully use the home, about, register, login all of the built in functionality. However I cannot navigate to my new content I added, it gives an error 500. Again all of this functionality does work locally. I am very new to ASP.Net MVC and could use any help I can get.
RouteConfig
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
Index action of my added controller
private UsersContext uc = new UsersContext();
private UserProfile user = new UserProfile();
private Character character = new Character();
//
// GET: /Character/
public ActionResult Index()
{
user = uc.UserProfiles.Single(u => u.UserName == User.Identity.Name);
return View(uc.Characters.ToList().Where(c => c.AccountOwnerId == user.UserId));
}
Let me know if any other items would help. Oh I put this into my UsersContext instead of in a newly created DbContext.
public UsersContext()
: base("DefaultConnection")
{
}
public DbSet<UserProfile> UserProfiles { get; set; }
public DbSet<Character> Characters { get; set; }
EDIT: one thing i forgot to mention is that when i published, it did not add the email address field to userprofile or my entire Character table. I had to run SQL on the Azure manage portal to manually add those items.