我正在尝试组建一个简单的oData服务来访问Oracle数据库。我遵循了本教程:http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/appdev/dotnet/EntityFrameworkWCF/index.html,除了我正在使用我的数据库和VB.NET和EF 6.截至6月,Oracle 6应该支持EF 6。
我能够导航到根URL并查看我的所有实体,并且我能够将$元数据附加到URL并查看模式,但我尝试的任何查询都会产生:
<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<m:code/>
<m:message xml:lang="en-US">An error occurred while processing this request.</m:message>
<m:innererror>
<m:message>Operation could destabilize the runtime.</m:message>
<m:type>System.Security.VerificationException</m:type>
<m:stacktrace>
at queryable_reader(Object )
at System.Data.Services.Providers.ReflectionServiceProvider.GetQueryRootForResourceSet(ResourceSet container)
at System.Data.Services.Providers.ReflectionDataServiceProvider.GetQueryRootForResourceSet(ResourceSet resourceSet)
at System.Data.Services.Providers.DataServiceProviderWrapper.GetQueryRootForResourceSet(ResourceSetWrapper resourceSet)
at System.Data.Services.RequestUriProcessor.ComposeExpressionForEntitySet(SegmentInfo segment, IDataService service, Boolean isLastSegment, Boolean checkRights)
at System.Data.Services.RequestUriProcessor.ComposeExpressionForSegments(IList`1 segments, IDataService service, Boolean isCrossReferencingUri)
at System.Data.Services.RequestUriProcessor.ProcessRequestUri(Uri absoluteRequestUri, IDataService service, Boolean internalQuery)
at System.Data.Services.DataService`1.ProcessIncomingRequestUri()
at System.Data.Services.DataService`1.HandleRequest()
</m:stacktrace>
</m:innererror>
</m:error>
我找到了一些资源,表明我应该更改我的数据服务类以继承EntityFrameworkDataService而不是Data Service,但这些资源似乎已过时且所有参考alpha&amp;测试版和此类似乎不存在于发行版中。
我的数据服务类如下所示:
Imports System.Data.Services
Imports System.Data.Services.Common
Imports System.Linq
Imports System.ServiceModel.Web
Imports System.Data.Services.Providers
Namespace FTPOrders
Public Class WcfDataService
Inherits DataService(Of Entities)
' This method is called only once to initialize service-wide policies.
Public Shared Sub InitializeService(ByVal config As DataServiceConfiguration)
config.SetEntitySetAccessRule("*", EntitySetRights.AllRead)
config.SetServiceOperationAccessRule("*", ServiceOperationRights.AllRead)
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3
config.DataServiceBehavior.UseMetadataKeyOrderForBuiltInProviders = True
config.UseVerboseErrors = True
config.EnableTypeConversion = True
End Sub
End Class
End Namespace
有关消除此错误的任何想法将不胜感激。我希望避免重新开始并降级到EF 5.