i new programming please bear me asking nob question
i have created c# project in visual studio 2013, , working fine on localhost, have used code first approach create database , used update-database
in package manager console (and done successfully), tables created on local server , there no error on inserting values, problem started come when tried duplicate database web server (i using window hosting provided [bigrock][1], mentioning steps used me duplicate local server database hosting server.
- created sql server database on hosting panel(plesk panel).
- copied connection string , added
web.config
in visual studio, after save rebuilt project. - now downloaded sql server 2012 management studio, , filled details server database in "connect object explorer" section, tested connection , showing me databases hosted @ server database.
- opened package manager console in visual studio (on local server) , used
enable-migrations
followedupdate-migrations
. , got error invalid column name 'xyz'. - next checked database in management studio, , there can see tables created no column missing.
i ignored errors @ time when tried run website , tried register 1st user got same errors no idea these coming from
this getting on server (with whole stack trace):
invalid column name 'registereddate'.
invalid column name 'name'.
invalid column name 'mobile'.
invalid column name 'email'.description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code.
exception details: system.data.sqlclient.sqlexception: invalid column name 'registereddate'.
invalid column name 'name'.
invalid column name 'mobile'.
invalid column name 'email'.source error:
an unhandled exception generated during execution of current web request. information regarding origin , location of exception can identified using exception stack trace below.
stack trace:
[sqlexception (0x80131904): invalid column name 'registereddate'. invalid column name 'name'. invalid column name 'mobile'. invalid column name 'email'.] system.data.sqlclient.sqlconnection.onerror(sqlexception exception, boolean breakconnection, action
1 wrapcloseinaction) +1789270 system.data.sqlclient.sqlinternalconnection.onerror(sqlexception exception, boolean breakconnection, action
1 wrapcloseinaction) +5340622 system.data.sqlclient.tdsparser.throwexceptionandwarning(tdsparserstateobject stateobj, boolean callerhasconnectionlock, boolean asyncclose) +244 system.data.sqlclient.tdsparser.tryrun(runbehavior runbehavior, sqlcommand cmdhandler, sqldatareader datastream, bulkcopysimpleresultset bulkcopyhandler, tdsparserstateobject stateobj, boolean& dataready) +1691 system.data.sqlclient.sqlcommand.finishexecutereader(sqldatareader ds, runbehavior runbehavior, string resetoptionsstring) +275 system.data.sqlclient.sqlcommand.runexecutereadertds(commandbehavior cmdbehavior, runbehavior runbehavior, boolean returnstream, boolean async, int32 timeout, task& task, boolean asyncwrite, sqldatareader ds) +1421 system.data.sqlclient.sqlcommand.runexecutereader(commandbehavior cmdbehavior, runbehavior runbehavior, boolean returnstream, string method, taskcompletionsource1 completion, int32 timeout, task& task, boolean asyncwrite) +177 system.data.sqlclient.sqlcommand.internalexecutenonquery(taskcompletionsource
1 completion, string methodname, boolean sendtopipe, int32 timeout, boolean asyncwrite) +208 system.data.sqlclient.sqlcommand.executenonquery() +163 webmatrix.data.database.execute(string commandtext, object[] args) +111 webmatrix.webdata.databasewrapper.execute(string commandtext, object[] parameters) +14 webmatrix.webdata.simplemembershipprovider.createuserrow(idatabase db, string username, idictionary2 values) +671 webmatrix.webdata.simplemembershipprovider.createuserandaccount(string username, string password, boolean requireconfirmation, idictionary
2 values) +65 webmatrix.webdata.websecurity.createuserandaccount(string username, string password, object propertyvalues, boolean requireconfirmationtoken) +134 riduk.areas.mobile.controllers.appstartcontroller.register(userprofile model, string password) +191 lambda_method(closure , controllerbase , object[] ) +147 system.web.mvc.actionmethoddispatcher.execute(controllerbase controller, object[] parameters) +14 system.web.mvc.reflectedactiondescriptor.execute(controllercontext controllercontext, idictionary2 parameters) +156 system.web.mvc.controlleractioninvoker.invokeactionmethod(controllercontext controllercontext, actiondescriptor actiondescriptor, idictionary
2 parameters) +27 system.web.mvc.async.asynccontrolleractioninvoker.b__39(iasyncresult asyncresult, actioninvocation innerinvokestate) +22 system.web.mvc.async.wrappedasyncresult2.callenddelegate(iasyncresult asyncresult) +29 system.web.mvc.async.wrappedasyncresultbase
1.end() +49 system.web.mvc.async.asynccontrolleractioninvoker.endinvokeactionmethod(iasyncresult asyncresult) +34 system.web.mvc.async.asyncinvocationwithfilters.b__3d() +50 system.web.mvc.async.<>c__displayclass46.b__3f() +225 system.web.mvc.async.<>c__displayclass33.b__32(iasyncresult asyncresult) +10 system.web.mvc.async.wrappedasyncresult1.callenddelegate(iasyncresult asyncresult) +10 system.web.mvc.async.wrappedasyncresultbase
1.end() +49 system.web.mvc.async.asynccontrolleractioninvoker.endinvokeactionmethodwithfilters(iasyncresult asyncresult) +34 system.web.mvc.async.<>c__displayclass2b.b__1c() +26 system.web.mvc.async.<>c__displayclass21.b__1e(iasyncresult asyncresult) +100 system.web.mvc.async.wrappedasyncresult1.callenddelegate(iasyncresult asyncresult) +10 system.web.mvc.async.wrappedasyncresultbase
1.end() +49 system.web.mvc.async.asynccontrolleractioninvoker.endinvokeaction(iasyncresult asyncresult) +27 system.web.mvc.controller.b__1d(iasyncresult asyncresult, executecorestate innerstate) +13 system.web.mvc.async.wrappedasyncvoid1.callenddelegate(iasyncresult asyncresult) +36 system.web.mvc.async.wrappedasyncresultbase
1.end() +54 system.web.mvc.controller.endexecutecore(iasyncresult asyncresult) +41 system.web.mvc.controller.b__15(iasyncresult asyncresult, controller controller) +12 system.web.mvc.async.wrappedasyncvoid1.callenddelegate(iasyncresult asyncresult) +28 system.web.mvc.async.wrappedasyncresultbase
1.end() +54 system.web.mvc.controller.endexecute(iasyncresult asyncresult) +31 system.web.mvc.controller.system.web.mvc.async.iasynccontroller.endexecute(iasyncresult asyncresult) +10 system.web.mvc.mvchandler.b__5(iasyncresult asyncresult, processrequeststate innerstate) +21 system.web.mvc.async.wrappedasyncvoid1.callenddelegate(iasyncresult asyncresult) +36 system.web.mvc.async.wrappedasyncresultbase
1.end() +54 system.web.mvc.mvchandler.endprocessrequest(iasyncresult asyncresult) +31 system.web.mvc.mvchandler.system.web.ihttpasynchandler.endprocessrequest(iasyncresult result) +9 system.web.callhandlerexecutionstep.system.web.httpapplication.iexecutionstep.execute() +9690164 system.web.httpapplication.executestep(iexecutionstep step, boolean& completedsynchronously) +155
this getting on using update-database
in package-manager console
no pending explicit migrations.
running seed method.
system.data.sqlclient.sqlexception (0x80131904): invalid column name 'registereddate'.
invalid column name 'dob'.
invalid column name 'email'.
invalid column name 'name'.at system.data.sqlclient.sqlconnection.onerror(sqlexception exception, boolean breakconnection, action
1 wrapcloseinaction)
1 wrapcloseinaction) @ system.data.sqlclient.tdsparser.throwexceptionandwarning(tdsparserstateobject stateobj, boolean callerhasconnectionlock, boolean asyncclose) @ system.data.sqlclient.tdsparser.tryrun(runbehavior runbehavior, sqlcommand cmdhandler, sqldatareader datastream, bulkcopysimpleresultset bulkcopyhandler, tdsparserstateobject stateobj, boolean& dataready) @ system.data.sqlclient.sqlcommand.finishexecutereader(sqldatareader ds, runbehavior runbehavior, string resetoptionsstring) @ system.data.sqlclient.sqlcommand.runexecutereadertds(commandbehavior cmdbehavior, runbehavior runbehavior, boolean returnstream, boolean async, int32 timeout, task& task, boolean asyncwrite, sqldatareader ds) @ system.data.sqlclient.sqlcommand.runexecutereader(commandbehavior cmdbehavior, runbehavior runbehavior, boolean returnstream, string method, taskcompletionsource
@ system.data.sqlclient.sqlinternalconnection.onerror(sqlexception exception, boolean breakconnection, action1 completion, int32 timeout, task& task, boolean asyncwrite) @ system.data.sqlclient.sqlcommand.internalexecutenonquery(taskcompletionsource
1 completion, string methodname, boolean sendtopipe, int32 timeout, boolean asyncwrite) @ system.data.sqlclient.sqlcommand.executenonquery() @ webmatrix.data.database.execute(string commandtext, object[] args) @ webmatrix.webdata.databasewrapper.execute(string commandtext, object[] parameters) @ webmatrix.webdata.simplemembershipprovider.createuserrow(idatabase db, string username, idictionary2 values) @ webmatrix.webdata.simplemembershipprovider.createuserandaccount(string username, string password, boolean requireconfirmation, idictionary
2 values) @ webmatrix.webdata.websecurity.createuserandaccount(string username, string password, object propertyvalues, boolean requireconfirmationtoken) @ myproject.migrations.configuration.seedmembership() in c:\users\me\desktop\project\myproject\myproject\migrations\configuration.cs:line 62 @ myproject.migrations.configuration.seed(userscontext context) in c:\users\me\desktop\project\myproject\myproject\migrations\configuration.cs:line 31 @ system.data.entity.migrations.dbmigrationsconfiguration1.onseed(dbcontext context) @ system.data.entity.migrations.dbmigrator.seeddatabase() @ system.data.entity.migrations.infrastructure.migratorloggingdecorator.seeddatabase() @ system.data.entity.migrations.dbmigrator.upgrade(ienumerable
1 pendingmigrations, string targetmigrationid, string lastmigrationid) @ system.data.entity.migrations.infrastructure.migratorloggingdecorator.upgrade(ienumerable`1 pendingmigrations, string targetmigrationid, string lastmigrationid) @ system.data.entity.migrations.dbmigrator.updateinternal(string targetmigration) @ system.data.entity.migrations.dbmigrator.<>c__displayclassc.b__b() @ system.data.entity.migrations.dbmigrator.ensuredatabaseexists(action mustsucceedtokeepdatabase) @ system.data.entity.migrations.infrastructure.migratorbase.ensuredatabaseexists(action mustsucceedtokeepdatabase) @ system.data.entity.migrations.dbmigrator.update(string targetmigration) @ system.data.entity.migrations.infrastructure.migratorbase.update(string targetmigration) @ system.data.entity.migrations.design.toolingfacade.updaterunner.run() @ system.appdomain.docallback(crossappdomaindelegate callbackdelegate) @ system.appdomain.docallback(crossappdomaindelegate callbackdelegate) @ system.data.entity.migrations.design.toolingfacade.run(baserunner runner) @ system.data.entity.migrations.design.toolingfacade.update(string targetmigration, boolean force) @ system.data.entity.migrations.updatedatabasecommand.<>c__displayclass2.<.ctor>b__0() @ system.data.entity.migrations.migrationsdomaincommand.execute(action command) clientconnectionid:1f5ed896-956b-43dd-a08c-ff86b144021f error number:207,state:1,class:16 invalid column name 'registereddate'. invalid column name 'dob'. invalid column name 'email'. invalid column name 'name'.
here connection string web.config
:
<connectionstrings> <add name="defaultconnection" connectionstring="data source=103.xx.xx.xx2;integrated security=false;user id=mydatabase;password=mypassword;connect timeout=15;encrypt=false;packet size=4096" providername="system.data.sqlclient" /> </connectionstrings>
i hope may sufficient guys nob,
***edit - deleted models , schema privacy concern
i unable solve problem found workaround while chatting bigrock support person,i took following steps resolve problem :-
- connected sql management server studio local database.
- followed steps given here i.e. right click on desired database -> click tasks -> click -> click ok , ".bak" file created @ location specified you.(note- file name must .bak otherwise give error)
- open plesk panel -> click on backup manager -> database backup repository -> add backup -> upload .bak file have created in step 2 -> click ok (ignoring warning)
- done working fine.
**note- still looking cause of error in previous method
Comments
Post a Comment