SQLCE 4 - EF4.1 Internal error: Cannot open the shared memory region - sql

Hi im trying to run my MVC 3 application running SQLCE 4 embedded and EF4.1
i have used the data access methods as described in this tutorial
This works perfectly locally(obviously), but when running it on my hosting i get the below error message. It is a shared hosting enviroment.
Is it an open connection that is the problem? Shouldn't it be handled by the unit of work class that is returning the dbcontext as a singleton throughout the whole application as mentioned in the tutorial?
Any tips on what this might be caused by would be appreciated
Internal error: Cannot open the shared memory region.
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.SqlServerCe.SqlCeException: Internal
error: Cannot open the shared memory region.
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:
[SqlCeException (0x80004005): Internal error: Cannot open the shared memory region.]
System.Data.SqlServerCe.SqlCeConnection.ProcessResults(Int32 hr) +40
System.Data.SqlServerCe.SqlCeConnection.Open(Boolean silent) +2542
System.Data.SqlServerCe.SqlCeConnection.Open() +113
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +67
[EntityException: The underlying provider failed on Open.]
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +10975150
System.Data.EntityClient.EntityConnection.Open() +142
System.Data.Objects.ObjectContext.EnsureConnection() +97
System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) +66
System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator() +47
System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source) +220
System.Linq.Queryable.FirstOrDefault(IQueryable`1 source) +383
System.Data.Entity.Internal.InternalContext.QueryForModelHash() +349
System.Data.Entity.Internal.InternalContext.CompatibleWithModel(Boolean throwIfNoMetadata) +109
System.Data.Entity.CreateDatabaseIfNotExists`1.InitializeDatabase(TContext context) +373
System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +64
[DataException: An exception occurred while initializing the database. See the InnerException for details.]
System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +152
System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization() +199
System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input) +193
System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action) +235
System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +38
System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +89
System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +21
System.Data.Entity.Internal.Linq.InternalSet`1.Find(Object[] keyValues) +37
Web.Infrastructure.DataAccess.Repository`1.GetByID(Object id) +131
Web.Controllers.PagesController.Home() +154
lambda_method(Closure , ControllerBase , Object[] ) +79
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +264
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39
System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +129
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +784922
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +314
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +784976
System.Web.Mvc.Controller.ExecuteCore() +159
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +335
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +62
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +20
System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +54
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +453
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +371

This error indicates that the SQL Server Compact database file is located on a shared folder, not a local drive. That will not work.

Related

Creating tables with existing data source in Entity Framework

I am new to MVC (using MVC4 and EF5) and I have been following the introductory tutorial (http://www.asp.net/mvc/overview/gett...adding-a-model) to create a model, controller,and the views. I want to create an "Orders" screen where all orders are displayed, etc, just so I can understand CRUD operations with EF but when I publish to the server I am getting an error.
The first thing I did was right-click the models folder and add a new class to create a model:
Imports System.Data.Entity
Imports System.ComponentModel.DataAnnotations.Schema
Imports System.ComponentModel.DataAnnotations
<Table("Orders")> _
Public Class Orders
<Key()> _
<DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)> _
Public Property OrderID As Integer
Public Property UserID As Integer
Public Property OrderDate As DateTime
Public Property OrderAmount As Decimal
End Class
Public Class OrdersDBContext
Inherits DbContext
Public Sub New()
MyBase.New("OrdersDBContext")
End Sub
Public OrderList As DbSet(Of Orders)
Public Property Orders As DbSet(Of Orders)
End Class
The next thing I did was add a line item into the Web.Config file:
<add name="OrdersDBContext" connectionString="Data Source=dbnumber.db.1and1.com,1433;Initial Catalog=db620663152;User Id=dbo620663152;Password=xxxxx;" providerName="System.Data.SqlClient" />
I built the project, eventually was able to create an "OrdersController" by right-clicking on the controller folder and selecting "Add Controller", making the appropriate selections in the wizard. Controller is now added. When I actually navigate to the newly-added orders area, I get the following error:
Server Error in '/' Application.
CREATE DATABASE permission denied in database 'master'.
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: CREATE DATABASE permission denied in database 'master'.
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:
[SqlException (0x80131904): CREATE DATABASE permission denied in database 'master'.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +1787814
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5341674
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +546
System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +1693
System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite) +869
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite) +413
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +163
System.Data.SqlClient.<>c__DisplayClassa.<DbCreateDatabase>b__7(SqlConnection conn) +33
System.Data.SqlClient.SqlProviderServices.UsingConnection(SqlConnection sqlConnection, Action`1 act) +92
System.Data.SqlClient.SqlProviderServices.UsingMasterConnection(SqlConnection sqlConnection, Action`1 act) +379
System.Data.SqlClient.SqlProviderServices.DbCreateDatabase(DbConnection connection, Nullable`1 commandTimeout, StoreItemCollection storeItemCollection) +276
System.Data.Objects.ObjectContext.CreateDatabase() +84
System.Data.Entity.Migrations.Utilities.DatabaseCreator.Create(DbConnection connection) +84
System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists() +70
System.Data.Entity.Migrations.DbMigrator.Update(String targetMigration) +44
System.Data.Entity.Internal.DatabaseCreator.CreateDatabase(InternalContext internalContext, Func`3 createMigrator, ObjectContext objectContext) +253
System.Data.Entity.Internal.InternalContext.CreateDatabase(ObjectContext objectContext) +125
System.Data.Entity.Database.Create(Boolean skipExistsCheck) +115
System.Data.Entity.CreateDatabaseIfNotExists`1.InitializeDatabase(TContext context) +307
System.Data.Entity.Internal.<>c__DisplayClass8.<PerformDatabaseInitialization>b__6() +19
System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +60
System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization() +181
System.Data.Entity.Internal.LazyInternalContext.<InitializeDatabase>b__4(InternalContext c) +7
System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input) +110
System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action) +185
System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase() +73
System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +28
System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +52
System.Data.Entity.Internal.Linq.InternalSet`1.GetEnumerator() +15
System.Data.Entity.Infrastructure.DbQuery`1.System.Collections.Generic.IEnumerable<TResult>.GetEnume rator() +40
System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +369
System.Linq.Enumerable.ToList(IEnumerable`1 source) +58
TampaBayDeliveryV4.OrdersController.Index() +21
lambda_method(Closure , ControllerBase , Object[] ) +62
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +181
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
System.Web.Mvc.Async.<>c__DisplayClass42.<BeginInvokeSynchronousActionMethod>b__41() +28
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +10
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +50
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +32
System.Web.Mvc.Async.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33() +58
System.Web.Mvc.Async.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() +225
System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__36(IAsyncResult asyncResult) +10
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +50
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +34
System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +24
System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +99
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +50
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +14
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +39
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +29
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +25
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
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() +9651516
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34280
So, I am not really sure whats going on here. I am using a shared host and cannot access the database remotely; I also cannot have the code create a new database, the code needs to use the existing database and add the tables. This was fine for the account model (it created the necessary underlying tables for authentication/accounts). I think the issue here is that the code expects to create a new database (since the table for orders doesn't exist yet?).
If I am not off-base with my assumption, what should I do to tell my MVC app to use the existing data-source in the connection string rather than try and create a whole new database? I just basically want my application to create the tables with the given connection string in the web.config file.
Thanks for any advice.

MVC razor debug and release

I am developping an application in MVC 4 (.Net 4.5.2) using Visual Studio 2012. My application is to fill forms and save it into SQL database
What's happen is when I test on Localhost I don't have any error but when I publish on the server from time to time I have error message
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: The compiler failed with error code 1.
Show Detailed Compiler Output:
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34248
it's been many days and I am not able to find what's going one, Sometimes I have this error and sometimes not, I am not able to see where is the problem, Any help please??
[HttpCompileException]: External component has thrown an exception.
at System.Web.Compilation.AssemblyBuilder.Compile() at
System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at
System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath
virtualPath) at
System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath
virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean
allowBuildInPrecompile, Boolean throwIfNotFound, Boolean
ensureIsUpToDate) at
System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext
context, VirtualPath virtualPath, Boolean noBuild, Boolean
allowCrossApp, Boolean allowBuildInPrecompile, Boolean
throwIfNotFound, Boolean ensureIsUpToDate) at
System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath
virtualPath, HttpContext context, Boolean allowCrossApp, Boolean
throwIfNotFound) at
System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath
virtualPath, Type requiredBaseType, HttpContext context, Boolean
allowCrossApp) at
System.Web.WebPages.BuildManagerWrapper.CreateInstanceOfType[T](String
virtualPath) at
System.Web.WebPages.VirtualPathFactoryExtensions.CreateInstance[T](IVirtualPathFactory
factory, String virtualPath) at
System.Web.WebPages.VirtualPathFactoryManager.CreateInstanceOfType[T](String
virtualPath) at
System.Web.WebPages.VirtualPathFactoryExtensions.CreateInstance[T](IVirtualPathFactory
factory, String virtualPath) at
System.Web.WebPages.WebPageBase.CreatePageFromVirtualPath(String
virtualPath, HttpContextBase httpContext, Func`2 virtualPathExists,
DisplayModeProvider displayModeProvider, IDisplayMode displayMode)
at
System.Web.WebPages.WebPageBase.<>c__DisplayClass3.b__2(TextWriter
writer) at System.Web.WebPages.HelperResult.WriteTo(TextWriter
writer) at System.Web.WebPages.WebPageBase.Write(HelperResult
result) at System.Web.WebPages.WebPageBase.RenderSurrounding(String
partialViewName, Action 1 body) at
System.Web.WebPages.WebPageBase.PopContext() at
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext
pageContext, TextWriter writer, WebPageRenderingBase startPage) at
System.Web.Mvc.RazorView.RenderView(ViewContext viewContext,
TextWriter writer, Object instance) at
System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext
viewContext, TextWriter writer) at
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
at
System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext
controllerContext, ActionResult actionResult) at
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList
1 filters, Int32 filterIndex, ResultExecutingContext preContext,
ControllerContext controllerContext, ActionResult actionResult) at
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList
1 filters, Int32 filterIndex, ResultExecutingContext preContext,
ControllerContext controllerContext, ActionResult actionResult) at
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext
controllerContext, IList 1 filters, ActionResult actionResult) at
System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<>c__DisplayClass2b.b__1c()
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.b__1e(IAsyncResult
asyncResult) at
System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult
1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase 1.End()
at
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult
asyncResult) at
System.Web.Mvc.Controller.b__1d(IAsyncResult
asyncResult, ExecuteCoreState innerState) at
System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid
1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase 1.End()
at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.b__15(IAsyncResult
asyncResult, Controller controller) at
System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid
1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase 1.End()
at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
at
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult
asyncResult) at
System.Web.Mvc.MvcHandler.b__5(IAsyncResult
asyncResult, ProcessRequestState innerState) at
System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid
1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase 1.End()
at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult
asyncResult) at
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult
result) at
System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
Boolean& completedSynchronously)

Simple Membeship Provider Exception - A network-related or instance-specific error occurred while establishing a connection

I am getting below exception when running my code from the host
When I run from my local machine connecting to the remote database everything works fine. Once deployed into the webhost the Simple Membeship Provider throws the below exception. I am using the same connection string in other controllers and there is no issues - connection to the database is fine.
This is the line I believe generates the exception:
WebSecurity.InitializeDatabaseConnection("MapEntities", "UserProfile", "UserId", "UserName", autoCreateTables: true);
Any clue? Thanks a lot.
[SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5061946
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +234
System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity) +341
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject) +129
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout) +270
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) +185
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.Data.SqlClient.SqlProviderServices.UsingConnection(SqlConnection sqlConnection, Action`1 act) +85
System.Data.SqlClient.SqlProviderServices.UsingMasterConnection(SqlConnection sqlConnection, Action`1 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.RetryLazy`2.GetValue(TInput input) +117
System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +453
System.Data.Entity.Internal.InternalContext.CreateObjectContextForDdlOps() +17
System.Data.Entity.Database.Exists() +42
indspire.Filters.SimpleMembershipInitializer..ctor() in e:\Visual Studio 2012\indspire\Filters\InitializeSimpleMembershipAttribute.cs:35
[InvalidOperationException: The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588]
indspire.Filters.SimpleMembershipInitializer..ctor() in e:\Visual Studio 2012\indspire\Filters\InitializeSimpleMembershipAttribute.cs:54
[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.Threading.LazyHelpers`1.ActivatorFactorySelector() +81
System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +113
System.Threading.LazyInitializer.EnsureInitialized(T& target, Boolean& initialized, Object& syncLock) +127
indspire.Filters.InitializeSimpleMembershipAttribute.OnActionExecuting(ActionExecutingContext filterContext) in e:\Visual Studio 2012\indspire\Filters\InitializeSimpleMembershipAttribute.cs:22
System.Web.Mvc.Async.AsyncControllerActionInvoker.InvokeActionMethodFilterAsynchronously(IActionFilter filter, ActionExecutingContext preContext, Func`1 nextInChain) +74
System.Web.Mvc.Async.<>c__DisplayClass3b.<BeginInvokeActionMethodWithFilters>b__35() +20
System.Web.Mvc.Async.AsyncControllerActionInvoker.InvokeActionMethodFilterAsynchronously(IActionFilter filter, ActionExecutingContext preContext, Func`1 nextInChain) +511
System.Web.Mvc.Async.<>c__DisplayClass3b.<BeginInvokeActionMethodWithFilters>b__35() +20
System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__31(AsyncCallback asyncCallback, Object asyncState) +190
System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +159
System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters, AsyncCallback callback, Object state) +182
System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__1e(AsyncCallback asyncCallback, Object asyncState) +478
System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +123
System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeAction(ControllerContext controllerContext, String actionName, AsyncCallback callback, Object state) +287
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__17(AsyncCallback asyncCallback, Object asyncState) +30
System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +123
System.Web.Mvc.Controller.BeginExecuteCore(AsyncCallback callback, Object state) +343
System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +123
System.Web.Mvc.Controller.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +282
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +15
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__2(AsyncCallback asyncCallback, Object asyncState) +76
System.Web.Mvc.Async.WrappedAsyncResult`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +123
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +236
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +48
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +16
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8970436
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184
Finally figured out what was wrong. There are references to the connection string on the the filter 'InitializeSimpleMembershipAttribute.cs' (where I had changed before) and on the model 'AccountModels.cs' (the one I didn't know).
So updating the connection string in the model was the solution.
One thing I don't understand is that it worked running on my local machine connecting to the remote db even with the "wrong" connection string.

ASP.Net MVC3 SQL Connection String

I am creating an app on APPHARBOR and I have an entity model for querying the SQL server. The following String is givving me error:
<add name="TraxzDBEntities"
connectionString="metadata=res://*/Models.DBModel.csdl|res://*/Models.DBModel.ssdl|res://*/Models.DBModel.msl;
provider=System.Data.SqlClient;
provider connection string='Data Source=d5d3955e-1183-4e10-8892-9f9d005af0a8.sqlserver.sequelizer.com;
User ID=**;
Password=**;
Initial Catalog=dbd5d3955e11834e1088929f9d005af0a8;Integrated Security=true;
MultipleActiveResultSets=True'"
providerName="System.Data.EntityClient" />
Here is the stack trace:
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: Keyword not supported: 'server'.
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: Keyword not supported: 'server'.]
System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +5110868
System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) +98
System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) +112
System.Data.EntityClient.EntityConnection..ctor(String connectionString) +77
System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String name, ConnectionStringSettingsCollection connectionStrings) +309
System.Data.Entity.Internal.LazyInternalConnection.Initialize() +52
System.Data.Entity.Internal.LazyInternalConnection.get_ConnectionHasModel() +10
System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +265
System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +18
System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +62
System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +15
System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider() +37
System.Linq.Queryable.Where(IQueryable`1 source, Expression`1 predicate) +63
Traxz.Models.TraxzRepository.getListOfUserExerciseSessions(Guid userID) in d:\temp\lhvy3m2t.j0d\input\Traxz\Models\TraxzRepository.cs:77
Traxz.Controllers.ExerciseSessionController.listSessions(Nullable`1 page, Nullable`1 SessionID) in d:\temp\lhvy3m2t.j0d\input\Traxz\Controllers\ExerciseSessionController.cs:34
lambda_method(Closure , ControllerBase , Object[] ) +164
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +208
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +55
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +263
System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +19
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +191
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +343
System.Web.Mvc.Controller.ExecuteCore() +116
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50
System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8963149
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184
I wasted numerous hours on this, and idk what is wrong.. Please help.
There is seemingly some other connect string being used here. Are you setting a connect string in code as well?
in your asp.net mvc project what are all the connect strings in the web.config? Just the above?
Search your entire solution for the word "server"
To add to Adam's suggestion (which is probably the answer), in your code snippet you don't have a ; after Password=** (maybe you do in the real code though). And you are also using both username and password and Integrated Security=true; which doesn't make sense to me since Integrated Security=true; means to use the currently logged on user.

ServiceLocator has not been initialized; I was trying to retrieve SharpArch.Core.CommonValidator.IValidator

Server Error in '/' Application.
ServiceLocator has not been initialized; I was trying to retrieve SharpArch.Core.CommonValidator.IValidator
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.NullReferenceException: ServiceLocator has not been initialized; I was trying to retrieve SharpArch.Core.CommonValidator.IValidator
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:
[NullReferenceException: ServiceLocator has not been initialized; I was trying to retrieve SharpArch.Core.CommonValidator.IValidator]
SharpArch.Core.SafeServiceLocator`1.GetService() in C:\MyStuff\Projects\SharpArchGitHub\src\SharpArch\SharpArch.Core\SafeServiceLocator.cs:20
SharpArch.Core.DomainModel.ValidatableObject.get_Validator() in C:\MyStuff\Projects\SharpArchGitHub\src\SharpArch\SharpArch.Core\DomainModel\ValidatableObject.cs:20
SharpArch.Core.DomainModel.ValidatableObject.ValidationResults() in C:\MyStuff\Projects\SharpArchGitHub\src\SharpArch\SharpArch.Core\DomainModel\ValidatableObject.cs:15
SharpArch.Web.ModelBinder.SharpModelBinder.OnModelUpdated(ControllerContext controllerContext, ModelBindingContext bindingContext) in C:\MyStuff\Projects\SharpArchGitHub\src\SharpArch\SharpArch.Web\ModelBinder\SharpModelBinder.cs:40
System.Web.Mvc.DefaultModelBinder.BindComplexElementalModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Object model) +304
System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +772
System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +345
SharpArch.Web.ModelBinder.SharpModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) in C:\MyStuff\Projects\SharpArchGitHub\src\SharpArch\SharpArch.Web\ModelBinder\SharpModelBinder.cs:241
System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor) +219
System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor) +109
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +399
System.Web.Mvc.Controller.ExecuteCore() +126
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +27
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +7
System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) +151
System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext) +57
System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext) +7
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
It's been awhile since I've looked at the S#arp Architecture framework, but my guess is that you're missing some initialization routine to set up its IOC container. If I recall correctly, S#arp supports multiple IOC containers, which are wrapped in a ServiceLocator.
Have you tried posting your question on the S#arp Architecture mailing list as well?