Error: "Spatial types and functions are not available for this provider..." while saving to DB
Posted: Wed 30 Aug 2017 14:07
I use the dotConnect for PostgreSQL version 7.7.819.0 to connect my Asp.NET Web API application running on IIS to a PostgreSQL 9.5 database running on Apache Tomcat on a separate virtual server (VPS).
When I try to add multiple records locally, while my the app on my machine is connected to the online database, everything works fine.
When I try to add multiple records online, I get the error from the title. The error occurs when the dispose method on my unit of work is triggered, so when the records are stored in the database.
The weird thing is, I am not saving any geo information, just plain ASP.NET datatypes
Full error:
Message: Spatial types and functions are not available for this provider because the assembly 'Microsoft.SqlServer.Types' version 10 or higher could not be found. , Stacktrace: at System.Data.Entity.SqlServer.SqlTypesAssemblyLoader.GetSqlTypesAssembly()\r\n at System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromText(String wellKnownText)\r\n at System.Data.Entity.Core.Mapping.Update.Internal.Propagator.ExtentPlaceholderCreator.InitializeSpatialTypeDefaultMap()\r\n at System.Lazy`1.CreateValue()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Lazy`1.get_Value()\r\n at System.Data.Entity.Core.Mapping.Update.Internal.Propagator.ExtentPlaceholderCreator.GetPropagatorResultForPrimitiveType(PrimitiveType primitiveType, PropagatorResult& result)\r\n at System.Data.Entity.Core.Mapping.Update.Internal.Propagator.ExtentPlaceholderCreator.Visit(EdmMember node)\r\n at System.Data.Entity.Core.Mapping.Update.Internal.Propagator.ExtentPlaceholderCreator.CreateEntitySetPlaceholder(EntitySet entitySet)\r\n at System.Data.Entity.Core.Mapping.Update.Internal.Propagator.Visit(DbScanExpression node)\r\n at System.Data.Entity.Core.Mapping.Update.Internal.Propagator.Visit(DbProjectExpression node)\r\n at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.<ProduceDynamicCommands>d__a.MoveNext()\r\n at System.Linq.Enumerable.<ConcatIterator>d__71`1.MoveNext()\r\n at System.Data.Entity.Core.Mapping.Update.Internal.UpdateCommandOrderer..ctor(IEnumerable`1 commands, UpdateTranslator translator)\r\n at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.ProduceCommands()\r\n at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()\r\n at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)\r\n at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesToStore(SaveOptions options, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction)\r\n at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesInternal(SaveOptions options, Boolean executeInExistingTransaction)\r\n at System.Data.Entity.Internal.InternalContext.SaveChanges()\r\n at WE.GprVoorraad.Repositories.EF.EFUnitOfWork.Dispose() in C:\\***\\WE.GprVoorraad.Repositories.EF\\EFUnitOfWork.cs:line 33\r\n at WE.GprVoorraad.Api.Controllers.UploadController.<PostCsvFile>d__6.MoveNext() in C:\\***\\WE.GprVoorraad.Api\\Controllers\\UploadController.cs:line 168\\n"
When I try to add multiple records locally, while my the app on my machine is connected to the online database, everything works fine.
When I try to add multiple records online, I get the error from the title. The error occurs when the dispose method on my unit of work is triggered, so when the records are stored in the database.
The weird thing is, I am not saving any geo information, just plain ASP.NET datatypes
Full error:
Message: Spatial types and functions are not available for this provider because the assembly 'Microsoft.SqlServer.Types' version 10 or higher could not be found. , Stacktrace: at System.Data.Entity.SqlServer.SqlTypesAssemblyLoader.GetSqlTypesAssembly()\r\n at System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromText(String wellKnownText)\r\n at System.Data.Entity.Core.Mapping.Update.Internal.Propagator.ExtentPlaceholderCreator.InitializeSpatialTypeDefaultMap()\r\n at System.Lazy`1.CreateValue()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Lazy`1.get_Value()\r\n at System.Data.Entity.Core.Mapping.Update.Internal.Propagator.ExtentPlaceholderCreator.GetPropagatorResultForPrimitiveType(PrimitiveType primitiveType, PropagatorResult& result)\r\n at System.Data.Entity.Core.Mapping.Update.Internal.Propagator.ExtentPlaceholderCreator.Visit(EdmMember node)\r\n at System.Data.Entity.Core.Mapping.Update.Internal.Propagator.ExtentPlaceholderCreator.CreateEntitySetPlaceholder(EntitySet entitySet)\r\n at System.Data.Entity.Core.Mapping.Update.Internal.Propagator.Visit(DbScanExpression node)\r\n at System.Data.Entity.Core.Mapping.Update.Internal.Propagator.Visit(DbProjectExpression node)\r\n at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.<ProduceDynamicCommands>d__a.MoveNext()\r\n at System.Linq.Enumerable.<ConcatIterator>d__71`1.MoveNext()\r\n at System.Data.Entity.Core.Mapping.Update.Internal.UpdateCommandOrderer..ctor(IEnumerable`1 commands, UpdateTranslator translator)\r\n at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.ProduceCommands()\r\n at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()\r\n at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)\r\n at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesToStore(SaveOptions options, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction)\r\n at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesInternal(SaveOptions options, Boolean executeInExistingTransaction)\r\n at System.Data.Entity.Internal.InternalContext.SaveChanges()\r\n at WE.GprVoorraad.Repositories.EF.EFUnitOfWork.Dispose() in C:\\***\\WE.GprVoorraad.Repositories.EF\\EFUnitOfWork.cs:line 33\r\n at WE.GprVoorraad.Api.Controllers.UploadController.<PostCsvFile>d__6.MoveNext() in C:\\***\\WE.GprVoorraad.Api\\Controllers\\UploadController.cs:line 168\\n"