Invalid column name .Don't Know Why? - asp.net-mvc

Recently i add DateofBirth to a table . And Locally it's work fine.
I also update client's data base and entity data model. But errors appears.
Invalid column name 'DateofBirth'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Invalid column name 'DateofBirth'.
Stack Trace:
[SqlException (0x80131904): Invalid column name 'DateofBirth'.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) +3305692
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +736
System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4061
System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() +90
System.Data.SqlClient.SqlDataReader.get_MetaData() +99
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted) +604
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) +3303
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) +667
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +83
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +301
System.Data.Entity.Infrastructure.Interception.InternalDispatcher1.Dispatch(TTarget target, Func3 operation, TInterceptionContext interceptionContext, Action3 executing, Action3 executed) +104
System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext) +499
System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) +36
[EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details.]
System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) +125
System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlan.Execute(ObjectContext context, ObjectParameterCollection parameterValues) +1014
System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction(Func1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess) +459
System.Data.Entity.Core.Objects.<>c__DisplayClass7.<GetResults>b__5() +203
System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Func1 operation) +234
System.Data.Entity.Core.Objects.ObjectQuery1.GetResults(Nullable1 forMergeOption) +354
System.Data.Entity.Core.Objects.ObjectQuery1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0() +30
System.Data.Entity.Internal.LazyEnumerator1.MoveNext() +39
System.Collections.Generic.List1..ctor(IEnumerable1 collection) +436
System.Linq.Enumerable.ToList(IEnumerable1 source) +70
BLAST.Controllers.EmployeeVarityReportController.EmpDetails() +5302
lambda_method(Closure , ControllerBase , Object[] ) +87
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) +229
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) +35
System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +39
System.Web.Mvc.Async.WrappedAsyncResult2.CallEndDelegate(IAsyncResult asyncResult) +77
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.AsyncInvocationWithFilters.b__3d() +72
System.Web.Mvc.Async.<>c__DisplayClass46.b__3f() +387
System.Web.Mvc.Async.<>c__DisplayClass46.b__3f() +387
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.<>c__DisplayClass2b.b__1c() +38
System.Web.Mvc.Async.<>c__DisplayClass21.b__1e(IAsyncResult asyncResult) +188
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
System.Web.Mvc.Controller.b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29
System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +73
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +52
System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +39
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38
System.Web.Mvc.MvcHandler.b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +43
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +73
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +602
System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +195
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +128

The column does not exist in the table, you must run migrations or use other means to update the customer database

Based on the stack trace, I suspect that you have set the AutomaticMigrationsEnabled to false in the configuration class. To fix this you need to manually create a new migration file. you can create new migration running the Add-Migration command in the Nuget Package Manager Console.
Here is a tutorial on how to create a new migration script.

I get this kind of error when I update my table in database but not in the data binding or mapping in my interface yet. After refreshing my data source in my data binding level then all went good. So I guess this error is caused by data sync/update on database level and interfacing level. So, what I must do is to check all the field control-column table mapping.

Make sure that your query has proper quotations.
For example,
cmd.CommandText = "insert into student(id,name,dob) values("+id+","+name+","+dob+")";
is an exception bound way of writing a query.
Try it in this way
cmd.CommandText = "insert into student(id,name,dob) values('"+id+"','"+name+"','"+dob+"')";

Related

Receiving error page when publishing new view pages MVC 5 to IIS 8.5 , works fine debugging on local

Server Error in '' Application. After turning off customErrors.
Receiving the below on two new view pages, i created the views, they work fine when debugging on my local.
The views are cshtml, from iEnumerable models, returning a toList()
using currentURL Request.URL.AbsoluteURi in the view which might be the problem?
I've denied annonymous authentication, enabled windows auth.
There is already an open DataReader associated with this Command which must be closed first.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: There is already an open DataReader associated with this Command which must be closed first.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: There is already an open DataReader associated with this Command which must be closed first.]
System.Data.SqlClient.SqlInternalConnectionTds.ValidateConnectionForExecute(SqlCommand command) +2076283
System.Data.SqlClient.SqlCommand.ValidateCommand(String method, Boolean async) +328
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +130
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +98
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +202
System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch(TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed) +104
System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext) +505
System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) +37
[EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details.]
System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) +126
System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlan.Execute(ObjectContext context, ObjectParameterCollection parameterValues) +1047
System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction(Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess) +469
System.Data.Entity.Core.Objects.<>c__DisplayClass7.<GetResults>b__5() +205
System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Func`1 operation) +238
System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) +349
System.Data.Entity.Core.Objects.DataClasses.EntityReference`1.Load(MergeOption mergeOption) +188
System.Data.Entity.Core.Objects.DataClasses.RelatedEnd.DeferredLoad() +449
System.Data.Entity.Core.Objects.Internal.LazyLoadBehavior.LoadProperty(TItem propertyValue, String relationshipName, String targetRoleName, Boolean mustBeNull, Object wrapperObject) +131
System.Data.Entity.Core.Objects.Internal.<>c__DisplayClass7`2.<GetInterceptorDelegate>b__2(TProxy proxy, TItem item) +151
System.Data.Entity.DynamicProxies.Milestone_A196562B8A8F9C6DAB6533FEB9BCA439C46C7CA6A6A60E91A85439617B2A923F.get_Initiative() +39
WAD_MP.Controllers.MilestonesController.List(Nullable`1 id) +979
lambda_method(Closure , ControllerBase , Object[] ) +145
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +209
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +35
System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +39
System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +67
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +72
System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +386
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +30
System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +186
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +65
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +36
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38
System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +44
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +65
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +399
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +137
Solved by changing the if statement query to ToList()
rather than just converting toList at end of controller, i had to make sure the if statements were using toList() as well

MVC 4 Application : Login failed sql exception

I am getting the error
SqlException (0x80131904): Login failed for user 'raam030'
for my ASP.NET MVC4 application. Works fine on my development machine using local SQL Server but when I deployed it to the web hosting this is what I am getting. I have searched for same questions, there are many but none of them helped me so far.
I have the stack trace below, I triple-checked and made sure my connection string is correct and SQL Server authentication is correct. Though my hosting services connection string does not require password information I tried variations without and with hard coded password and user name.
<connectionStrings>
<add name="RMSDelta"
connectionString="Data Source=mssql2.openhost.net.nz;Integrated Security=False;User ID=myusername; Password=mypassword;Connect Timeout=15;Encrypt=False;Network Library=dbmssocn;Packet Size=4096"
providerName="System.Data.SqlClient" />
</connectionStrings>
I am using code first approach. My database name is the same I used as connection string name, same name used to pass as connection string in my context class. Made sure the provider name is correct. Except the data access part (and page which needed data) every other page works fine with my application.. I am not really sure what else to make out of this stack trace??
Please help me.
Stack Trace:
[SqlException (0x80131904): Login failed for user 'raam030'.]
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +1316
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +108
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +126
System.Data.SqlClient.SqlConnection.Open() +125
System.Data.SqlClient.SqlProviderServices.UsingConnection(SqlConnection sqlConnection, Action1 act) +85
System.Data.SqlClient.SqlProviderServices.UsingMasterConnection(SqlConnection sqlConnection, Action1 act) +349
System.Data.SqlClient.SqlProviderServices.GetDbProviderManifestToken(DbConnection connection) +265
System.Data.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +34
[ProviderIncompatibleException: The provider did not return a ProviderManifestToken string.]
System.Data.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +163
System.Data.Entity.ModelConfiguration.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection) +40
[ProviderIncompatibleException: An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct.]
System.Data.Entity.ModelConfiguration.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection) +163
System.Data.Entity.ModelConfiguration.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProviderManifest& providerManifest) +39
System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection) +46
System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) +62
System.Data.Entity.Internal.RetryLazy2.GetValue(TInput input) +117
System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +453
System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +18
System.Data.Entity.Internal.Linq.InternalSet1.Initialize() +56
System.Data.Entity.Internal.Linq.InternalSet1.GetEnumerator() +15
System.Data.Entity.Infrastructure.DbQuery1.System.Collections.Generic.IEnumerable.GetEnumerator() +40
System.Linq.WhereSelectEnumerableIterator2.MoveNext() +63
ASP._Page_Views_Default_Qualifications_cshtml.Execute() in d:\vhosts\rameshsivaraman.me\httpdocs\Views\Default\Qualifications.cshtml:45
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +209
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +104
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +78
System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +234
System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +107
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +291
System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13
System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17() +23
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation) +264
System.Web.Mvc.<>c_DisplayClass1c.b_19() +20
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList1 filters, ActionResult actionResult) +176
System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +71
System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +128
System.Web.Mvc.Async.WrappedAsyncResult1.End() +50
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +26
System.Web.Mvc.<>c_DisplayClass1d.b_18(IAsyncResult asyncResult) +14
System.Web.Mvc.Async.<>c_DisplayClass4.b_3(IAsyncResult ar) +25
System.Web.Mvc.Async.WrappedAsyncResult1.End() +55
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +41
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +25
System.Web.Mvc.Async.WrappedAsyncResult1.End() +55
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +28
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
System.Web.Mvc.<>c_DisplayClass8.b_3(IAsyncResult asyncResult) +28
System.Web.Mvc.Async.<>c_DisplayClass4.b_3(IAsyncResult ar) +25
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +30
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9041917
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184
How silly things are sometimes... It seems my hosting company somehow requires a password with more than 6 characters to authenticate into sql server, I was using 4 character password earlier when I used a longer one it did work, however the hosting providers Plesk panel accepts the password with 4 characters when I set up the account!!!. I had to spend half my day fiddling with this thing, I am gonna shoot an email right now asking why they don't display any caution about this... Thanks friends..

MVC 4 ConnectionString on my godaddy hosting Error 166

I am testing a website, mvc 4 website; I am learning actually MVC.
I have published the website to my personal hosting, on my computers works good, but once is on my hosting I have an error, here are the connection string first: (I am using northwind to practice)
<add name="NorthwindEntities" connectionString="metadata=res://*/Models.NorthWindModel.csdl|res://*/Models.NorthWindModel.ssdl|res://*/Models.NorthWindModel.msl;
provider=System.Data.SqlClient;
provider connection string="
data source=**************.db.********.hostedresource.com;;
initial catalog=**********;
User ID=******;
MultipleActiveResultSets=True;
App=EntityFramework"
Password='********';
integrated security=True;"
providerName="System.Data.EntityClient" />
and here is the error:
Format of the initialization string does not conform to specification starting at index 166.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Format of the initialization string does not conform to specification starting at index 166.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentException: Format of the initialization string does not conform to specification starting at index 166.]
System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) +5078242
System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +132
System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) +98
System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) +118
System.Data.EntityClient.EntityConnection..ctor(String connectionString) +81
System.Data.Entity.Internal.LazyInternalConnection.InitializeFromConnectionStringSetting(ConnectionStringSettings appConfigConnection) +78
System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String name, AppConfig config) +32
System.Data.Entity.Internal.LazyInternalConnection.Initialize() +131
System.Data.Entity.Internal.LazyInternalConnection.CreateObjectContextFromConnectionModel() +13
System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +281
System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +18
System.Data.Entity.Internal.Linq.InternalSet1.Initialize() +56
System.Data.Entity.Internal.Linq.InternalSet1.GetEnumerator() +15
System.Data.Entity.Infrastructure.DbQuery1.System.Collections.Generic.IEnumerable<TResult>.GetEnumerator() +40
System.Collections.Generic.List1..ctor(IEnumerable1 collection) +315
System.Linq.Enumerable.ToList(IEnumerable1 source) +58
MvcApplication1.Controllers.HomeController.Index() +21
lambda_method(Closure , ControllerBase , Object[] ) +62
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) +188
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters) +27
System.Web.Mvc.Async.<>c_DisplayClass42.b_41() +28
System.Web.Mvc.Async.<>c_DisplayClass81.<BeginSynchronous>b__7(IAsyncResult _) +12
System.Web.Mvc.Async.WrappedAsyncResult1.End() +50
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +29
System.Web.Mvc.Async.<>c_DisplayClass39.b_33() +59
System.Web.Mvc.Async.<>c_DisplayClass4f.b_49() +240
System.Web.Mvc.Async.<>c_DisplayClass37.b_36(IAsyncResult asyncResult) +12
System.Web.Mvc.Async.WrappedAsyncResult1.End() +50
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +31
System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +23
System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +128
System.Web.Mvc.Async.WrappedAsyncResult1.End() +50
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +26
System.Web.Mvc.<>c_DisplayClass1d.b_18(IAsyncResult asyncResult) +14
System.Web.Mvc.Async.<>c_DisplayClass4.b_3(IAsyncResult ar) +25
System.Web.Mvc.Async.WrappedAsyncResult1.End() +55
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +41
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +25
System.Web.Mvc.Async.WrappedAsyncResult1.End() +55
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +28
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
System.Web.Mvc.<>c_DisplayClass8.b_3(IAsyncResult asyncResult) +28
System.Web.Mvc.Async.<>c_DisplayClass4.b__3(IAsyncResult ar) +25
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +30
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8970061
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184
So, what in the world is happening? I have tried many different connectionStrings without success.
Thanks
Two adjacent ;; at position 166.
Try following the information in these GoDaddy articles:
Locating Your Database Connection Strings
Connecting to a SQL Server Database Using ASP.NET 3.5 (I realise you're using asp.net mvc 4 but maybe this will help)
If you need more help you should contact GoDaddy as this is too specific/localised for a StackOverflow question

error deploying asp.net mvc3 application with System.Data.Objects.ObjectSet

Maybe you can give a clue about this error, I have been googling and testing things for hours without result. I am using Mysql and Mysql connector 6.3.5. The error only happens on server, locally everything goes well.
The error:
Method not found:
'System.Data.Objects.ObjectSet`1
MyModelEntities.get_my_aspnet_Users()'.
StackTrace:
[MissingMethodException: Method not
found:
'System.Data.Objects.ObjectSet`1
MyModelEntities.get_my_aspnet_Users()'.]
Utils.GetCurrentUserId() +0
Project.Controllers.ApplicationController..ctor()
+70 Project.Controllers.HomeController..ctor()
+29
[TargetInvocationException: Exception
has been thrown by the target of an
invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType
type, Boolean publicOnly, Boolean
noCheck, Boolean& canBeCached,
RuntimeMethodHandleInternal& ctor,
Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean
publicOnly, Boolean skipCheckThis,
Boolean fillCache) +98
System.RuntimeType.CreateInstanceDefaultCtor(Boolean
publicOnly, Boolean
skipVisibilityChecks, Boolean
skipCheckThis, Boolean fillCache) +241
System.Activator.CreateInstance(Type
type, Boolean nonPublic) +69
System.Web.Mvc.DefaultControllerActivator.Create(RequestContext
requestContext, Type controllerType)
+67
[InvalidOperationException: An error
occurred when trying to create a
controller of type
'Project.Controllers.HomeController'.
Make sure that the controller has a
parameterless public constructor.]
System.Web.Mvc.DefaultControllerActivator.Create(RequestContext
requestContext, Type controllerType)
+182 System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext
requestContext, Type controllerType)
+80 System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext
requestContext, String controllerName)
+74 System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase
httpContext, IController& controller,
IControllerFactory& factory) +196
System.Web.Mvc.<>c_DisplayClass6.b_2()
+49 System.Web.Mvc.<>c__DisplayClassb1.<ProcessInApplicationTrust>b__a()
+13 System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action
f) +7
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action
action) +22
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Func1
func) +124
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase
httpContext, AsyncCallback callback,
Object state) +98
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext
httpContext, AsyncCallback callback,
Object state) +50
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext
context, AsyncCallback cb, Object
extraData) +16
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+8841400 System.Web.HttpApplication.ExecuteStep(IExecutionStep
step, Boolean& completedSynchronously)
+184
A little bit more background info on your model would be needed to pinpoint the issue.
If I had to infer with only the stack trace... It seems that in your HomeController constructor there is a call to get_my_aspnet_Users on your model class - MyModelEntities. For some reason the code is not able to find that method.
Is it possible that you somehow have an older version of the model file that does not have the particular method your code is looking for?
Hope this helps.

Cannot open database, Login failed for user

I'm running the nerddinner MVC application on visual studio, and the database is on sql server 2008. I was previously having problems with permissions, etc but I seemed to have these sorted.
I created a user - taraw in SQL Server Management Studio, and got this all working. I can log into it fine.
When I test the application, I can see all the database entries, it is only however when I want to register a new user that the application crashes with this error:
closed.
Failed to generate a user instance of
SQL Server. Only an integrated
connection can generate a user
instance. The connection will be
closed.
I am using the aspnet membership api to register and maintain user accounts. I used the aspnet_regsql.exe tool to add the api tables to my existing database.
This is the connection string I have in the web.config file:
<connectionStrings>
<add name="ApplicationServices" connectionString="Data Source=localhost;Initial Catalog=nerddinner;user id=taraw;password=Password;User Instance=true" providerName="System.Data.SqlClient" />
<add name="nerddinnerEntities" connectionString="metadata=res://*/Models.NerdDinner.csdl|res://*/Models.NerdDinner.ssdl|res://*/Models.NerdDinner.msl;provider=System.Data.SqlClient;provider connection string="Data Source=localhost;Initial Catalog=nerddinner;user id=taraw;password=Password;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
</connectionStrings>
I would imagine the problem is with the Application Services connection string as I can see all the other information from the database fine.
Here is the stack trace,
[SqlException (0x80131904): Failed to generate a user instance of SQL Server. Only an integrated connection can generate a user instance. The connection will be closed.]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5009598
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +234
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2275
System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +35
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject) +183
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout) +239
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +195
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +232
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +5023255
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +33
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +524
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +479
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +108
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +126
System.Data.SqlClient.SqlConnection.Open() +125
System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context, Boolean revertImpersonate) +95
System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) +206
System.Web.Security.SqlMembershipProvider.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status) +2517
NerdDinner.Models.AccountMembershipService.CreateUser(String userName, String password, String email) in C:\Users\TaraW\Documents\Visual Studio 2010\Projects\MVC\NerdDinner\NerdDinner\Models\AccountModels.cs:127
NerdDinner.Controllers.AccountController.Register(RegisterModel model) in C:\Users\TaraW\Documents\Visual Studio 2010\Projects\MVC\NerdDinner\NerdDinner\Controllers\AccountController.cs:93
lambda_method(Closure , ControllerBase , Object[] ) +162
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +51
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +409
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +52
System.Web.Mvc.<>c__DisplayClassd.<InvokeActionMethodWithFilters>b__a() +127
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +436
System.Web.Mvc.<>c__DisplayClassf.<InvokeActionMethodWithFilters>b__c() +61
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +305
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +830
System.Web.Mvc.Controller.ExecuteCore() +136
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +111
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +39
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__4() +65
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +44
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +42
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +141
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +54
System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +52
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +38
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8841105
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184
EDIT:
I have also tried the following commands:
1>EXEC sp_grantlogin 'TaraW-PC\TaraW'
2>GO
1>USE nerddinner
2>GO
1>EXEC sp_grantdbaccess 'TaraW-PC\TaraW'
2>GO
1>EXIT
however I get the following error for that:
Msg 15063, Level 16, State 1, Server
TARAW-PC, Line 1 The login already has
an account under a different user nameclosed.
Best bet would be to leave user instance on and to let it use integrated security, then ASP.NET can create/own the database and you won't have to worry about it.
Anyhow, granting access to the windows account 'TaraW-PC\TaraW' won't help a lick here as you are not logging in with that account, you are logging in with a sql account called taraw. What you need to do is:
1) run aspnet_regsql to create your application services database.
2) create said account in the database
3) add that account to the various aspnetdb roles you'd need.
Removed "User Instance = true" from Application Services connection string. Did the trick for me.

Resources