5 Replies Latest reply on Apr 24, 2015 2:20 AM by Lonnie Bowling

    EntityFramework issues with OData CTP installed via PIWebAPI package

    jmcox1027

      I have the OData CTP installed via the PIWebAPI package. I can navigate to https://<hostname>/piwebapi/OData and see the list of AF databases. I can click on the PhysicalModel link and get an XML response containing various collections (ElementTemplates, Elements, etc), but when I click on the TemplateModel link, I get an HTTP 500 with the error below. Has anyone else had this issue with OData?

       

      {"Message":"An error has occurred.","ExceptionMessage":"The type initializer for 'System.Data.Entity.ModelConfiguration.Conventions.Sets.V2ConventionSet' threw an exception.","ExceptionType":"System.TypeInitializationException","StackTrace":"   at System.Data.Entity.ModelConfiguration.Conventions.Sets.V2ConventionSet.get_Conventions()\r\n   at OSIsoft.Entity.PiEntityModel.Dynamic.PiDynamicModelProvider.CreateModel(SchemaQualifiedName qualifiedSchemaName)\r\n   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)\r\n   at OSIsoft.Entity.PiEntityModel.Dynamic.PiDynamicModelProvider.GetModel(SchemaQualifiedName qualifiedSchemaName)\r\n   at OSIsoft.Entity.WebApi.Models.EdmModelProvider.CreateTemplateModel(SchemaQualifiedName qualifiedSchemaName)\r\n   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)\r\n   at OSIsoft.Entity.WebApi.Models.EdmModelProvider.GetEdmModel(SchemaQualifiedName qualifiedSchemaName)\r\n   at OSIsoft.Entity.WebApi.Extensions.PiODataRootPathRouteConstraint.GetDynamicRoute(SchemaQualifiedName schemaName, String routeName, HttpRouteCollection routes)\r\n   at OSIsoft.Entity.WebApi.Extensions.PiODataRootPathRouteConstraint.Match(HttpRequestMessage request, IHttpRoute route, String parameterName, IDictionary`2 values, HttpRouteDirection routeDirection)\r\n   at OSIsoft.REST.OData.PIWebApiPathRouteConstraint.Match(HttpRequestMessage request, IHttpRoute route, String parameterName, IDictionary`2 values, HttpRouteDirection routeDirection)\r\n   at System.Web.Http.Routing.HttpRoute.ProcessConstraint(HttpRequestMessage request, Object constraint, String parameterName, HttpRouteValueDictionary values, HttpRouteDirection routeDirection)\r\n   at System.Web.Http.Routing.HttpRoute.ProcessConstraints(HttpRequestMessage request, HttpRouteValueDictionary values, HttpRouteDirection routeDirection)\r\n   at System.Web.Http.Routing.HttpRoute.GetRouteData(String virtualPathRoot, HttpRequestMessage request)\r\n   at System.Web.Http.HttpRouteCollection.GetRouteData(HttpRequestMessage request)\r\n   at System.Web.Http.Dispatcher.HttpRoutingDispatcher.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n   at System.Web.Http.Cors.CorsMessageHandler.<SendAsync>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at OSIsoft.REST.Handlers.CacheControlHandler.<SendAsync>d__1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at OSIsoft.REST.Handlers.InstrumentationMessageHandler.<SendAsync>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at OSIsoft.REST.Handlers.LoggingHandler.<SendAsync>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at OSIsoft.REST.Handlers.GzipCompressionHandler.<SendAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at System.Web.Http.HttpServer.<SendAsync>d__0.MoveNext()","InnerException":{"Message":"An error has occurred.","ExceptionMessage":"The type initializer for 'System.Data.Entity.ModelConfiguration.Conventions.Sets.V1ConventionSet' threw an exception.","ExceptionType":"System.TypeInitializationException","StackTrace":"   at System.Data.Entity.ModelConfiguration.Conventions.Sets.V1ConventionSet.get_Conventions()\r\n   at System.Data.Entity.ModelConfiguration.Conventions.Sets.V2ConventionSet..cctor()","InnerException":{"Message":"An error has occurred.","ExceptionMessage":"The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.","ExceptionType":"System.InvalidOperationException","StackTrace":"   at System.Data.Entity.Infrastructure.DependencyResolution.ProviderServicesFactory.GetInstance(String providerTypeName, String providerInvariantName)\r\n   at System.Data.Entity.Internal.AppConfig.<.ctor>b__2(ProviderElement e)\r\n   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()\r\n   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)\r\n   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)\r\n   at System.Data.Entity.Internal.AppConfig.<.ctor>b__1()\r\n   at System.Lazy`1.CreateValue()\r\n   at System.Lazy`1.LazyInitValue()\r\n   at System.Data.Entity.Internal.AppConfig.get_DbProviderServices()\r\n   at System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.RegisterDbProviderServices()\r\n   at System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.GetServiceFactory(Type type, String name)\r\n   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)\r\n   at System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.GetService(Type type, Object key)\r\n   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()\r\n   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)\r\n   at System.Data.Entity.Infrastructure.DependencyResolution.CompositeResolver`2.GetService(Type type, Object key)\r\n   at System.Data.Entity.Infrastructure.DependencyResolution.DbDependencyResolverExtensions.GetService[T](IDbDependencyResolver resolver)\r\n   at System.Data.Entity.ModelConfiguration.Conventions.TypeAttributeConfigurationConvention`1..ctor()\r\n   at System.Data.Entity.ModelConfiguration.Conventions.Sets.V1ConventionSet..cctor()"}}}