asp.net mvc 4 - Controller not working after publish to azure website -
i have created simple web site using asp.net mvc 4, internet application. added controller, model , associated views new page. works fine running locally, can register, login , use new page functionality. after publishing azure website can use home, about, register, login of built in functionality. cannot navigate new content added, gives error 500. again of functionality work locally. new asp.net mvc , use 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 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 other items help. oh put userscontext instead of in newly created dbcontext.
public userscontext() : base("defaultconnection") { } public dbset<userprofile> userprofiles { get; set; } public dbset<character> characters { get; set; }
edit: 1 thing forgot mention when published, did not add email address field userprofile or entire character table. had run sql on azure manage portal manually add items.
after frustration of trying understand why wasn't working decided start over. deleted website azure sql db. added new website , sql db grabbed new publish settings file. imported vs , published. worked fresh install, not sure botched first time around working intended now. thanks,
Comments
Post a Comment