“System.NotSupportedException”类型的未经处理的异常在 Microsoft.Data.Services.Client.dll 中发生

其他信息: 对此 POST 请求的响应未包含“location”标头。此客户端不支持这种做法。

未处理System.NotSupportedException
  HResult=-2146233067
  Message=对此 POST 请求的响应未包含“location”标头。此客户端不支持这种做法。
  Source=Microsoft.Data.Services.Client
  StackTrace:
       在 System.Data.Services.Client.BaseSaveResult.HandleOperationResponseHeaders(HttpStatusCode statusCode, HeaderCollection headers)
       在 System.Data.Services.Client.SaveResult.CreateNextChange()
       在 System.Data.Services.Client.DataServiceContext.SaveChanges(SaveChangesOptions options)
       在 Quick.Framework.Site.Common.OData.ODataContextClient.Add[TBizModel](TBizModel[] entities) 位置 d:\Set working folder\Quick.Framework\Quick.Framework.Site.Common\OData\ODataContextClient.cs:行号 59
       在 EbcBuy.Bll.Orders.UnitTest.OrderODataClientTest.OrderCommentsWebApiODataTest(ODataContextClient orderClient) 位置 d:\Set working folder\EbcBuy.Bll\EbcBuy.Bll.Orders\EbcBuy.Bll.Orders.UnitTest\OrderODataClientTest.cs:行号 43
       在 EbcBuy.Bll.Orders.UnitTest.OrderODataClientTest.Test() 位置 d:\Set working folder\EbcBuy.Bll\EbcBuy.Bll.Orders\EbcBuy.Bll.Orders.UnitTest\OrderODataClientTest.cs:行号 34
       在 EbcBuy.Bll.Orders.UnitTest.Program.Main(String[] args) 位置 d:\Set working folder\EbcBuy.Bll\EbcBuy.Bll.Orders\EbcBuy.Bll.Orders.UnitTest\Program.cs:行号 20
       在 System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       在 System.Threading.ThreadHelper.ThreadStart()
  InnerException:

===================================================

"<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<m:error xmlns:m=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\">\r\n  <m:code />\r\n  <m:message xml:lang=\"en-US\">出现错误。</m:message>\r\n  <m:innererror>\r\n    <m:message>序列包含一个以上的元素</m:message>\r\n    <m:type>System.InvalidOperationException</m:type>\r\n    <m:stacktrace>   在 System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source) \n   在 System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.&lt;GetElementFunction&gt;b__2[TResult](IEnumerable`1 sequence) \n   在 System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable`1 query, Expression queryRoot) \n   在 System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[TResult](Expression expression) \n   在 System.Data.Entity.Internal.Linq.DbQueryProvider.Execute[TResult](Expression expression) \n   在 System.Linq.Queryable.SingleOrDefault[TSource](IQueryable`1 source, Expression`1 predicate) \n   在 System.Data.Entity.Migrations.DbSetMigrationsExtensions.AddOrUpdate[TEntity](DbSet`1 set, IEnumerable`1 identifyingProperties, InternalSet`1 internalSet, TEntity[] entities) \n   在 System.Data.Entity.Migrations.DbSetMigrationsExtensions.AddOrUpdate[TEntity](IDbSet`1 set, Expression`1 identifierExpression, TEntity[] entities) \n   在 EbcBuy.Dal.Users.Data.Migrations.Configuration.Seed(EFDbContextUsers context) \n   在 System.Data.Entity.Migrations.DbMigrationsConfiguration`1.OnSeed(DbContext context) \n   在 System.Data.Entity.Migrations.DbMigrator.SeedDatabase() \n   在 System.Data.Entity.Migrations.DbMigrator.Upgrade(IEnumerable`1 pendingMigrations, String targetMigrationId, String lastMigrationId) \n   在 System.Data.Entity.Migrations.DbMigrator.UpdateInternal(String targetMigration) \n   在 System.Data.Entity.Migrations.DbMigrator.&lt;&gt;c__DisplayClassc.&lt;Update&gt;b__b() \n   在 System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists(Action mustSucceedToKeepDatabase) \n   在 System.Data.Entity.Migrations.DbMigrator.Update(String targetMigration) \n   在 System.Data.Entity.MigrateDatabaseToLatestVersion`2.InitializeDatabase(TContext context) \n   在 System.Data.Entity.Internal.InternalContext.&lt;&gt;c__DisplayClassf`1.&lt;CreateInitializationAction&gt;b__e() \n   在 System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) \n   在 System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization() \n   在 System.Data.Entity.Internal.LazyInternalContext.&lt;InitializeDatabase&gt;b__4(InternalContext c) \n   在 System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input) \n   在 System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action) \n   在 System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase() \n   在 System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) \n   在 System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() \n   在 System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() \n   在 System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider() \n   在 System.Linq.Queryable.Select[TSource,TResult](IQueryable`1 source, Expression`1 selector) \n   在 EbcBuy.Bll.Users.Services.Impl.CustomersInfoService.GetQueryOfSingleRecord() \n   在 EbcBuy.Bll.Users.Services.Impl.CustomersInfoService.GetCustomerById(Int64 ownerId, Int64 customerId) \n   在 EbcBuy.Bll.Users.Services.Impl.CustomersInfoService.Add(CustomersInfo entity) \n   在 EbcBuy.Bll.Users.WebApi.Controllers.CustomersInfoController.&lt;&gt;c__DisplayClass8.&lt;Post&gt;b__7() 位置 d:\\Set working folder\\EbcBuy.Bll\\EbcBuy.Bll.Users\\EbcBuy.Bll.Users.WebApi\\Controllers\\CustomersInfoController.cs:行号 75 \n   在 System.Threading.Tasks.Task`1.InnerInvoke() \n   在 System.Threading.Tasks.Task.Execute() \n--- 引发异常的上一位置中堆栈跟踪的末尾 --- \n   在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) \n   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) \n   在 System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() \n   在 EbcBuy.Bll.Users.WebApi.Controllers.CustomersInfoController.&lt;Post&gt;d__a.MoveNext() 位置 d:\\Set working folder\\EbcBuy.Bll\\EbcBuy.Bll.Users\\EbcBuy.Bll.Users.WebApi\\Controllers\\CustomersInfoController.cs:行号 73 \n--- 引发异常的上一位置中堆栈跟踪的末尾 --- \n   在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) \n   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) \n   在 System.Threading.Tasks.TaskHelpersExtensions.&lt;CastToObject&gt;d__3`1.MoveNext() \n--- 引发异常的上一位置中堆栈跟踪的末尾 --- \n   在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) \n   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) \n   在 System.Web.Http.Controllers.ApiControllerActionInvoker.&lt;InvokeActionAsyncCore&gt;d__0.MoveNext() \n--- 引发异常的上一位置中堆栈跟踪的末尾 --- \n   在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) \n   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) \n   在 System.Web.Http.Controllers.ActionFilterResult.&lt;ExecuteAsync&gt;d__2.MoveNext() \n--- 引发异常的上一位置中堆栈跟踪的末尾 --- \n   在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) \n   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) \n   在 System.Web.Http.Dispatcher.HttpControllerDispatcher.&lt;SendAsync&gt;d__1.MoveNext()</m:stacktrace>\r\n  </m:innererror>\r\n</m:error>"

============================================================

“System.InvalidOperationException”类型的未经处理的异常在 EntityFramework.dll 中发生

其他信息: 实体类型 ProductComments 不是当前上下文的模型的一部分。
【解决办法】在Dal层相应的Data项目里,添加Map类(数据表与PO的映射),ProductCommentsMapping
========================================================

"<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<m:error xmlns:m=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\">\r\n  <m:code />\r\n  <m:message xml:lang=\"en-US\">请求无效。</m:message>\r\n  <m:innererror>\r\n    <m:message>对于“EbcBuy.Bll.Orders.WebApi.Controllers.ComplaintController”中方法“System.Threading.Tasks.Task`1[System.Web.Http.IHttpActionResult] Patch(Int64, System.Web.Http.OData.Delta`1[EbcBuy.Bll.Orders.Models.Complaint])”的不可以为 null 的类型“System.Int64”的参数“key”,参数字典包含一个 null 项。可选参数必须为引用类型、可以为 null 的类型或声明为可选参数。</m:message>\r\n    <m:type></m:type>\r\n    <m:stacktrace></m:stacktrace>\r\n  </m:innererror>\r\n</m:error>"
【解决办法】Patch方法key参数前加"[FromODataUri]

======================================================

【ComplaintLog实体类里有如下枚举类型的属性定义
public ComplainOperation OperationType { get; set; }
当有方法使用时,如OperationType = ComplainOperation.Apply,则在OData客户端调用时会出现如下异常】
“System.InvalidOperationException”类型的未经处理的异常在 Microsoft.Data.Services.Client.dll 中发生

其他信息: 类型“EbcBuy.Bll.Common.Enums.ComplainOperation”没有可设置的属性。
【即使不使用该属性,也会报上述异常。
但定义成可空类型的话,不使用不报异常,使用则报同样异常。】
=======================================================
<m:message xml:lang="en-US">请求无效。</m:message>

<m:innererror>

<m:message>
对于“EbcBuy.Bll.Orders.WebApi.Controllers.ComplaintController”中方法“System.Web.Http.SingleResult`1[EbcBuy.Bll.Orders.Models.Complaint] Get(Int64)”的不可以为 null 的类型“System.Int64”的参数“key”,参数字典包含一个 null 项。可选参数必须为引用类型、可以为 null 的类型或声明为可选参数。
</m:message>
【】通过ie测试ComplaintController的Get方法时,使用http://localhost:39380/odata/Complaint(281406301643290151) 这个url报错。因为主键是long型, 所以,需在id后加L标记,即url改为http://localhost:39380/odata/Complaint(281406301643290151L)
=============================================================
<m:error>
<m:code/>
<m:message xml:lang="en-US">出现错误。</m:message>

<m:innererror>

<m:message>
“ObjectContent`1”类型未能序列化内容类型“application/json; charset=utf-8”的响应正文。
</m:message>
<m:type>System.InvalidOperationException</m:type>
<m:stacktrace/>

<m:internalexception>

<m:message>
'SingleResult`1' cannot be serialized using the ODataMediaTypeFormatter.
</m:message>

<m:type>
System.Runtime.Serialization.SerializationException
</m:type>
【解决办法】在Get(key)方法上面加[Queryable]

=========================================
【执行userClient.GetEntities<ReturnOrder>().ToList();提示如下异常:】"<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<m:error xmlns:m=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\">\r\n  <m:code />\r\n  <m:message xml:lang=\"en-US\">出现错误。</m:message>\r\n  <m:innererror>\r\n    <m:message>“ObjectContent`1”类型未能序列化内容类型“application/atom+xml; charset=utf-8”的响应正文。</m:message>\r\n    <m:type>System.InvalidOperationException</m:type>\r\n    <m:stacktrace></m:stacktrace>\r\n    <m:internalexception>\r\n      <m:message>Null collections cannot be serialized.</m:message>\r\n      <m:type>System.Runtime.Serialization.SerializationException</m:type>\r\n      
<m:stacktrace>   在 System.Web.Http.OData.Formatter.Serialization.ODataCollectionSerializer.CreateODataValue(Object graph, IEdmTypeReference expectedType, ODataSerializerContext writeContext) \n   在 System.Web.Http.OData.Formatter.Serialization.ODataEdmTypeSerializer.CreateProperty(Object graph, IEdmTypeReference expectedType, String elementName, ODataSerializerContext writeContext) \n   在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.CreateStructuralProperty(IEdmStructuralProperty structuralProperty, EntityInstanceContext entityInstanceContext) \n   在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.CreateStructuralPropertyBag(IEnumerable`1 structuralProperties, EntityInstanceContext entityInstanceContext) \n   在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.CreateEntry(SelectExpandNode selectExpandNode, EntityInstanceContext entityInstanceContext) \n   在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.WriteEntry(Object graph, ODataWriter writer, ODataSerializerContext writeContext) \n   在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.WriteObjectInline(Object graph, IEdmTypeReference expectedType, ODataWriter writer, ODataSerializerContext writeContext) \n   在 System.Web.Http.OData.Formatter.Serialization.ODataFeedSerializer.WriteFeed(IEnumerable enumerable, IEdmTypeReference feedType, ODataWriter writer, ODataSerializerContext writeContext) \n   在 System.Web.Http.OData.Formatter.Serialization.ODataFeedSerializer.WriteObjectInline(Object graph, IEdmTypeReference expectedType, ODataWriter writer, ODataSerializerContext writeContext) \n   在 System.Web.Http.OData.Formatter.Serialization.ODataFeedSerializer.WriteObject(Object graph, Type type, ODataMessageWriter messageWriter, ODataSerializerContext writeContext) \n   在 System.Web.Http.OData.Formatter.ODataMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, HttpContent content, HttpContentHeaders contentHeaders) \n   在 System.Web.Http.OData.Formatter.ODataMediaTypeFormatter.WriteToStreamAsync(Type type, Object value, Stream writeStream, HttpContent content, TransportContext transportContext, CancellationToken cancellationToken) \n--- 引发异常的上一位置中堆栈跟踪的末尾 --- \n   在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) \n   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) \n   在 System.Web.Http.WebHost.HttpControllerHandler.&lt;WriteBufferedResponseContentAsync&gt;d__1b.MoveNext()</m:stacktrace>\r\n    </m:internalexception>\r\n  </m:innererror>\r\n</m:error>"
【问题及解决办法】在ReturnOrder的构造器里指定如下属性初始化:
            Pictures = new List<PictureModel>();
            ////ReturnOrderType = Common.Models.ReturnOrderType.RetailOrder;
            //TheStatus = ReturnOrderStatus.AgreeReturnMoney;
            //ServiceType = ReturnServiceType.None;
            ReturnOrderLogs = new List<ReturnOrderLog>();

======================================================
【用[DataServiceEntity]声明了PictureModel,
但未在WebApiConfig.cs中指定builder.EntitySet<PictureModel>("PictureModel");
会报如下异常:】
“System.InvalidOperationException”类型的未经处理的异常在 Microsoft.Data.Services.Client.dll 中发生

其他信息: 在 {http://schemas.microsoft.com/ado/2007/08/dataservices/metadata}:properties 元素中发现“EbcBuy.Bll.Orders.Models.ReturnOrder”类型上的“Pictures”属性,并且它被声明为导航属性。ATOM 中的导航属性必须表示为 {http://www.w3.org/2005/Atom}:link 元素。

============================================
【在WebApiConfig.cs中指定了builder.EntitySet<PictureModel>("PictureModel");,
但未用[DataServiceEntity]声明了PictureModel。
会报如下异常:】
“System.InvalidOperationException”类型的未经处理的异常在 Microsoft.Data.Services.Client.dll 中发生

其他信息: 类型“EbcBuy.Bll.Orders.Models.ReturnOrder”上名为“Pictures”的属性具有种类“Structural”,但它应为“Navigation”种类。
【解决办法】用[DataServiceEntity]修饰PictureModel类

===============================================
【如果做了上述2处的设定, 则执行GetReturnOrderById调用ODataClient的GetEntity方法后,得到的Picture属性值为null;
如果同时不做上述2处的设定,则执行GetReturnOrderById调用ODataClient的GetEntity方法后,得到的Picture属性有值】

====================================================
【对于ReturnOrderLog实体,同时去掉上述2处设定,则会报如下异常:
(如果去掉Id属性,则没有异常发生,跟PictureModel一样)】
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<m:error xmlns:m=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\">\r\n  <m:code />\r\n  <m:message xml:lang=\"en-US\">出现错误。</m:message>\r\n  <m:innererror>\r\n    <m:message>“ObjectContent`1”类型未能序列化内容类型“application/atom+xml; charset=utf-8”的响应正文。</m:message>\r\n    <m:type>System.InvalidOperationException</m:type>\r\n    <m:stacktrace></m:stacktrace>\r\n    <m:internalexception>\r\n      <m:message>No NavigationLink factory was found for the navigation property 'ReturnOrderLogs' from entity type 'EbcBuy.Bll.Orders.Models.ReturnOrder' on entity set 'ReturnOrder'. Try calling HasNavigationPropertyLink on the EntitySetConfiguration. \n参数名: navigationProperty</m:message>\r\n      <m:type>System.ArgumentException</m:type>\r\n      <m:stacktrace>   在 System.Web.Http.OData.Builder.EntitySetLinkBuilderAnnotation.BuildNavigationLink(EntityInstanceContext instanceContext, IEdmNavigationProperty navigationProperty, ODataMetadataLevel metadataLevel) \n   在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.CreateNavigationLink(IEdmNavigationProperty navigationProperty, EntityInstanceContext entityInstanceContext) \n   在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.&lt;CreateNavigationLinks&gt;d__1.MoveNext() \n   在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.WriteNavigationLinks(IEnumerable`1 navigationProperties, EntityInstanceContext entityInstanceContext, ODataWriter writer) \n   在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.WriteEntry(Object graph, ODataWriter writer, ODataSerializerContext writeContext) \n   在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.WriteObjectInline(Object graph, IEdmTypeReference expectedType, ODataWriter writer, ODataSerializerContext writeContext) \n   在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.WriteObject(Object graph, Type type, ODataMessageWriter messageWriter, ODataSerializerContext writeContext) \n   在 System.Web.Http.OData.Formatter.ODataMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, HttpContent content, HttpContentHeaders contentHeaders) \n   在 System.Web.Http.OData.Formatter.ODataMediaTypeFormatter.WriteToStreamAsync(Type type, Object value, Stream writeStream, HttpContent content, TransportContext transportContext, CancellationToken cancellationToken) \n--- 引发异常的上一位置中堆栈跟踪的末尾 --- \n   在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) \n   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) \n   在 System.Web.Http.WebHost.HttpControllerHandler.&lt;WriteBufferedResponseContentAsync&gt;d__1b.MoveNext()</m:stacktrace>\r\n    </m:internalexception>\r\n  </m:innererror>\r\n</m:error>"

============================================================

【】在WebApiConfig.cs中,如果加了builder.EntitySet<ContactInfoModel>("ContactInfoModel");则通过ie访问的结果是:
{
  "odata.metadata":"http://localhost:39380/odata/$metadata#ReturnOrder/@Element","ReturnOrderId":"1406271033590870","ReturnOrderType":0,"Product":{
    "ProductId":"123","ProductName":"\u7fe0\u8d1d\u5361\u4e0a\u8863","MainPic":"this is a url here.","SkuId":123111,"SkuName":"\u9ad8\u8c03\u7ea2"
  },"OrderId":"123","ServiceType":1,"FreightPayType":1,"AskQuantity":1,"ReturnMoney":"1120.00","ProblemDisc":"model.ProblemDisc","CustomerId":"111","CustomerName":"\u6d4b\u8bd5CustomerName","ShopId":"111","ShopName":"\u6d4b\u8bd5ShopName","TheStatus":1
}

【否则是】:
{
  "odata.metadata":"http://localhost:39380/odata/$metadata#ReturnOrder/@Element","ReturnOrderId":"1406271033590870","ReturnOrderType":0,"Product":{
    "ProductId":"123","ProductName":"\u7fe0\u8d1d\u5361\u4e0a\u8863","MainPic":"this is a url here.","SkuId":123111,"SkuName":"\u9ad8\u8c03\u7ea2"
  },"OrderId":"123","ServiceType":1,"FreightPayType":1,"AskQuantity":1,"ReturnMoney":"1120.00","ProblemDisc":"model.ProblemDisc","CustomerId":"111","CustomerName":"\u6d4b\u8bd5CustomerName","CustomerContactInfo":{
    "ProvinceId":0,"ProvinceName":"Hebei","CityId":0,"CityName":"Tangshan","CountyId":0,"CountyName":"Fengrun","Address":"\u5317\u4eac\u897f\u5b89\u9633\u4e1c18:0921:5303:44\u5f53\u65e5\u5230\u8fbe","ZipCode":"100100","LinkMan":"\u6bd4\u5c14\u76d6\u8328","Telephone":null,"MobilePhone":"18233334444","EMail":null
  },"ShopId":"111","ShopName":"\u6d4b\u8bd5ShopName","ShopContactInfo":{
    "ProvinceId":0,"ProvinceName":"Hebei","CityId":0,"CityName":"Tangshan","CountyId":0,"CountyName":"Fengrun","Address":"\u5317\u4eac\u897f\u5b89\u9633\u4e1c18:0921:5303:44\u5f53\u65e5\u5230\u8fbe","ZipCode":"100100","LinkMan":"\u6bd4\u5c14\u76d6\u8328","Telephone":null,"MobilePhone":"18233334444","EMail":null
  },"TheStatus":1
}

=================================================

"<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<m:error xmlns:m=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\">\r\n  <m:code />\r\n  <m:message xml:lang=\"en-US\">出现错误。</m:message>\r\n  <m:innererror>\r\n    <m:message>“ObjectContent`1”类型未能序列化内容类型“application/atom+xml; charset=utf-8”的响应正文。</m:message>\r\n    <m:type>System.InvalidOperationException</m:type>\r\n    <m:stacktrace></m:stacktrace>\r\n    <m:internalexception>\r\n      <m:message>No NavigationLink factory was found for the navigation property 'ReturnOrderLogs' from entity type 'EbcBuy.Bll.Orders.Models.ReturnOrder' on entity set 'ReturnOrder'. Try calling HasNavigationPropertyLink on the EntitySetConfiguration. \n参数名: navigationProperty</m:message>

============================================
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<m:error xmlns:m=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\">\r\n  <m:code />\r\n  <m:message xml:lang=\"en-US\">出现错误。</m:message>\r\n  <m:innererror>\r\n    <m:message>执行命令定义时出错。有关详细信息,请参阅内部异常。</m:message>\r\n    <m:type>System.Data.Entity.Core.EntityCommandExecutionException</m:type>\r\n    <m:stacktrace>   在 System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) \n   在 System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues) \n   在 System.Data.Entity.Core.Objects.ObjectQuery`1.&lt;&gt;c__DisplayClass7.&lt;GetResults&gt;b__6() \n   在 System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess) \n   在 System.Data.Entity.Core.Objects.ObjectQuery`1.&lt;&gt;c__DisplayClass7.&lt;GetResults&gt;b__5() \n   在 System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute[TResult](Func`1 operation) \n   在 System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) \n   在 System.Data.Entity.Core.Objects.ObjectQuery`1.&lt;System.Collections.Generic.IEnumerable&lt;T&gt;.GetEnumerator&gt;b__0() \n   在 System.Data.Entity.Internal.LazyEnumerator`1.MoveNext() \n   在 System.Web.Http.QueryableAttribute.SingleOrDefault(IQueryable queryable, HttpActionDescriptor actionDescriptor) \n   在 System.Web.Http.QueryableAttribute.ExecuteQuery(Object response, HttpRequestMessage request, HttpActionDescriptor actionDescriptor) \n   在 System.Web.Http.QueryableAttribute.OnActionExecuted(HttpActionExecutedContext actionExecutedContext) \n   在 System.Web.Http.Filters.ActionFilterAttribute.OnActionExecutedAsync(HttpActionExecutedContext actionExecutedContext, CancellationToken cancellationToken) \n--- 引发异常的上一位置中堆栈跟踪的末尾 --- \n   在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) \n   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) \n   在 System.Web.Http.Filters.ActionFilterAttribute.&lt;CallOnActionExecutedAsync&gt;d__5.MoveNext() \n--- 引发异常的上一位置中堆栈跟踪的末尾 --- \n   在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) \n   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) \n   在 System.Web.Http.Filters.ActionFilterAttribute.&lt;ExecuteActionFilterAsyncCore&gt;d__0.MoveNext() \n--- 引发异常的上一位置中堆栈跟踪的末尾 --- \n   在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) \n   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) \n   在 System.Web.Http.Controllers.ActionFilterResult.&lt;ExecuteAsync&gt;d__2.MoveNext() \n--- 引发异常的上一位置中堆栈跟踪的末尾 --- \n   在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) \n   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) \n   在 System.Web.Http.Dispatcher.HttpControllerDispatcher.&lt;SendAsync&gt;d__0.MoveNext()</m:stacktrace>\r\n    <m:internalexception>\r\n      <m:message>There is already an open DataReader associated with this Connection which must be closed first.</m:message>\r\n      <m:type>MySql.Data.MySqlClient.MySqlException</m:type>\r\n      <m:stacktrace>   在 MySql.Data.MySqlClient.ExceptionInterceptor.Throw(Exception exception) \n   在 MySql.Data.MySqlClient.MySqlConnection.Throw(Exception ex) \n   在 MySql.Data.MySqlClient.MySqlCommand.CheckState() \n   在 MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) \n   在 MySql.Data.Entity.EFMySqlCommand.ExecuteDbDataReader(CommandBehavior behavior) \n   在 System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) \n   在 System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.&lt;Reader&gt;b__c(DbCommand t, DbCommandInterceptionContext`1 c) \n   在 System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed) \n   在 System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext) \n   在 System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavior behavior) \n   在 System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) \n   在 System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)</m:stacktrace>\r\n    </m:internalexception>\r\n  </m:innererror>\r\n</m:error>"

============================================
<m:message>
The type 'EbcBuy.Bll.Orders.Models.ContactInfoModel' appears in two structurally incompatible initializations within a single LINQ to Entities query. A type can be initialized in two places in the same query, but only if the same properties are set in both places and those properties are set in the same order.
</m:message>
【问题&解决方法】我在GetReturnOrderById方法里同时给CustomerContactInfo和ShopContactInfo赋值,二者是ContactInfoModel类型。 如上提示,要求二者赋值的顺序一样,并且罗列相同的属性。 改为如下
CustomerContactInfo = new ContactInfoModel
{
    ProvinceName = a.CustomerArea.ProvinceName,
    CityName = a.CustomerArea.CityName,
    CountyName = a.CustomerArea.DistrictName,
    Address = a.CustomerAddress,
    LinkMan = a.CustomerLinkMan,
    ZipCode = a.CustomerZipCode,
    MobilePhone = a.CustomerPhone
},
...
ShopContactInfo = new ContactInfoModel
{
    ProvinceName = a.ShopArea.ProvinceName,
    CityName = a.ShopArea.CityName,
    CountyName = a.ShopArea.DistrictName,
    Address = a.ShopAddress,
    LinkMan = a.ShopLinkMan,
    ZipCode = a.ShopZipCode,
    MobilePhone = a.ShopPhone,
    //Telephone = a.ShopTel      【注释掉】
},
===============================================
"<!DOCTYPE html>\r\n<html>\r\n    <head>\r\n        <title>分析器错误</title>\r\n        <meta name=\"viewport\" content=\"width=device-width\" />\r\n        <style>\r\n         body {font-family:\"Verdana\";font-weight:normal;font-size: .7em;color:black;} \r\n         p {font-family:\"Verdana\";font-weight:normal;color:black;margin-top: -5px}\r\n         b {font-family:\"Verdana\";font-weight:bold;color:black;margin-top: -5px}\r\n         H1 { font-family:\"Verdana\";font-weight:normal;font-size:18pt;color:red }\r\n         H2 { font-family:\"Verdana\";font-weight:normal;font-size:14pt;color:maroon }\r\n         pre {font-family:\"Consolas\",\"Lucida Console\",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}\r\n         .marker {font-weight: bold; color: black;text-decoration: none;}\r\n         .version {color: gray;}\r\n         .error {margin-bottom: 10px;}\r\n         .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }\r\n         @media screen and (max-width: 639px) {\r\n          pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }\r\n         }\r\n         @media screen and (max-width: 479px) {\r\n          pre { width: 280px; }\r\n         }\r\n        </style>\r\n    </head>\r\n\r\n    <body bgcolor=\"white\">\r\n\r\n            <span><H1>“/”应用程序中的服务器错误。<hr width=100% size=1 color=silver></H1>\r\n\r\n            <h2> <i>分析器错误</i> </h2></span>\r\n\r\n            <font face=\"Arial, Helvetica, Geneva, SunSans-Regular, sans-serif \">\r\n\r\n            <b> 说明: </b>在分析向此请求提供服务所需资源时出错。请检查下列特定分析错误详细信息并适当地修改源文件。\r\n            <br><br>\r\n\r\n            <b> 分析器错误消息: </b>未能加载类型“EbcBuy.Bll.Order.WebApi.WebApiApplication”。<br><br>\r\n\r\n            <b>源错误:</b> <br><br>\r\n\r\n            <table width=100% bgcolor=\"#ffffcc\">\r\n               <tr>\r\n                  <td>\r\n                      <code><pre>\r\n\r\n<font color=red>行 1:  &lt;%@ Application Codebehind=&quot;Global.asax.cs&quot; Inherits=&quot;EbcBuy.Bll.Order.WebApi.WebApiApplication&quot; Language=&quot;C#&quot; %&gt;\r\n</font></pre></code>\r\n\r\n                  </td>\r\n               </tr>\r\n            </table>\r\n\r\n            <br>\r\n\r\n            <b> 源文件: </b> /global.asax<b> &nbsp;&nbsp; 行: </b> 1\r\n            <br><br>\r\n\r\n            <hr width=100% size=1 color=silver>\r\n\r\n            <b>版本信息:</b>&nbsp;Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.0.30319.18446\r\n\r\n            </font>\r\n\r\n    </body>\r\n</html>\r\n<!-- \r\n[HttpException]: 未能加载类型“EbcBuy.Bll.Order.WebApi.WebApiApplication”。\r\n   在 System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError)\r\n   在 System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly)\r\n   在 System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData)\r\n[HttpParseException]: 未能加载类型“EbcBuy.Bll.Order.WebApi.WebApiApplication”。\r\n   在 System.Web.UI.TemplateParser.ProcessException(Exception ex)\r\n   在 System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)\r\n   在 System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)\r\n[HttpParseException]: 未能加载类型“EbcBuy.Bll.Order.WebApi.WebApiApplication”。\r\n   在 System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)\r\n   在 System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath)\r\n   在 System.Web.UI.TemplateParser.ParseInternal()\r\n   在 System.Web.UI.TemplateParser.Parse()\r\n   在 System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType()\r\n   在 System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)\r\n   在 System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()\r\n   在 System.Web.Compilation.BuildProvidersCompiler.PerformBuild()\r\n   在 System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp)\r\n   在 System.Web.Compilation.BuildManager.CompileGlobalAsax()\r\n   在 System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled()\r\n[HttpException]: 未能加载类型“EbcBuy.Bll.Order.WebApi.WebApiApplication”。\r\n   在 System.Web.Compilation.BuildManager.ReportTopLevelCompilationException()\r\n   在 System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled()\r\n   在 System.Web.Compilation.BuildManager.CallAppInitializeMethod()\r\n   在 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)\r\n[HttpException]: 未能加载类型“EbcBuy.Bll.Order.WebApi.WebApiApplication”。\r\n   在 System.Web.HttpRuntime.FirstRequestInit(HttpContext context)\r\n   在 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)\r\n   在 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)\r\n-->"

=============================================
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<m:error xmlns:m=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\">\r\n  <m:code />\r\n  <m:message xml:lang=\"en-US\">出现错误。</m:message>\r\n  <m:innererror>\r\n    <m:message>“ObjectContent`1”类型未能序列化内容类型“application/atom+xml; charset=utf-8”的响应正文。</m:message>\r\n    <m:type>System.InvalidOperationException</m:type>\r\n    <m:stacktrace></m:stacktrace>\r\n    <m:internalexception>\r\n      <m:message>No NavigationLink factory was found for the navigation property 'ReturnOrderLogs' from entity type 'EbcBuy.Bll.Orders.Models.ReturnOrder' on entity set 'ReturnOrder'. Try calling HasNavigationPropertyLink on the EntitySetConfiguration. \n参数名: navigationProperty</m:message>\r\n      <m:type>System.ArgumentException</m:type>\r\n      <m:stacktrace>   在 System.Web.Http.OData.Builder.EntitySetLinkBuilderAnnotation.BuildNavigationLink(EntityInstanceContext instanceContext, IEdmNavigationProperty navigationProperty, ODataMetadataLevel metadataLevel) \n   在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.CreateNavigationLink(IEdmNavigationProperty navigationProperty, EntityInstanceContext entityInstanceContext) \n   在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.&lt;CreateNavigationLinks&gt;d__1.MoveNext() \n   在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.WriteNavigationLinks(IEnumerable`1 navigationProperties, EntityInstanceContext entityInstanceContext, ODataWriter writer) \n   在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.WriteEntry(Object graph, ODataWriter writer, ODataSerializerContext writeContext) \n   在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.WriteObjectInline(Object graph, IEdmTypeReference expectedType, ODataWriter writer, ODataSerializerContext writeContext) \n   在 System.Web.Http.OData.Formatter.Serialization.ODataFeedSerializer.WriteFeed(IEnumerable enumerable, IEdmTypeReference feedType, ODataWriter writer, ODataSerializerContext writeContext) \n   在 System.Web.Http.OData.Formatter.Serialization.ODataFeedSerializer.WriteObjectInline(Object graph, IEdmTypeReference expectedType, ODataWriter writer, ODataSerializerContext writeContext) \n   在 System.Web.Http.OData.Formatter.Serialization.ODataFeedSerializer.WriteObject(Object graph, Type type, ODataMessageWriter messageWriter, ODataSerializerContext writeContext) \n   在 System.Web.Http.OData.Formatter.ODataMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, HttpContent content, HttpContentHeaders contentHeaders) \n   在 System.Web.Http.OData.Formatter.ODataMediaTypeFormatter.WriteToStreamAsync(Type type, Object value, Stream writeStream, HttpContent content, TransportContext transportContext, CancellationToken cancellationToken) \n--- 引发异常的上一位置中堆栈跟踪的末尾 --- \n   在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) \n   在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) \n   在 System.Web.Http.WebHost.HttpControllerHandler.&lt;WriteBufferedResponseContentAsync&gt;d__1b.MoveNext()</m:stacktrace>\r\n    </m:internalexception>\r\n  </m:innererror>\r\n</m:error>"
===========================================================

类型“EbcBuy.Bll.Common.Models.ReturnServiceType”没有可设置的属性。

在 System.Data.Services.Client.ClientEdmModel.GetOrCreateEdmType(Type type)
   在 System.Data.Services.Client.Materialization.StructuralValueMaterializationPolicy.ApplyDataValue(ClientTypeAnnotation type, ODataProperty property, Object instance)
   在 System.Data.Services.Client.Materialization.EntryValueMaterializationPolicy.MaterializeResolvedEntry(MaterializerEntry entry, Boolean includeLinks)
   在 System.Data.Services.Client.Materialization.EntryValueMaterializationPolicy.Materialize(MaterializerEntry entry, Type expectedEntryType, Boolean includeLinks)
   在 System.Data.Services.Client.Materialization.ODataEntityMaterializer.DirectMaterializePlan(ODataEntityMaterializer materializer, MaterializerEntry entry, Type expectedEntryType)
   在 System.Data.Services.Client.Materialization.ODataEntityMaterializerInvoker.DirectMaterializePlan(Object materializer, Object entry, Type expectedEntryType)
   在 System.Data.Services.Client.ProjectionPlan.Run(ODataEntityMaterializer materializer, ODataEntry entry, Type expectedType)
   在 System.Data.Services.Client.Materialization.ODataEntityMaterializer.ReadImplementation()
   在 System.Data.Services.Client.Materialization.ODataMaterializer.Read()
   在 System.Data.Services.Client.MaterializeAtom.MoveNextInternal()
   在 System.Data.Services.Client.MaterializeAtom.MoveNext()
   在 System.Linq.Enumerable.<CastIterator>d__b1`1.MoveNext()
   在 System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   在 System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   在 EbcBuy.Bll.Users.Test.OrderODataClientTest.Test() 位置 d:\Project_v3\EbcBuy.Bll\EbcBuy.Bll.Users\EbcBuy.Bll.Users.Test\OrderODataClientTest.cs:行号 17
   在 EbcBuy.Bll.Users.Test.Program.Main(String[] args) 位置 d:\Project_v3\EbcBuy.Bll\EbcBuy.Bll.Users\EbcBuy.Bll.Users.Test\Program.cs:行号 21
   在 System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   在 System.Threading.ThreadHelper.ThreadStart()

=========================================================
The entity type ReturnOrder is not part of the model for the current context.

在 System.Data.Entity.Internal.InternalContext.UpdateEntitySetMappingsForType(Type entityType)
   在 System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
   在 System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
   在 System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
   在 System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider()
   在 System.Linq.Queryable.Select[TSource,TResult](IQueryable`1 source, Expression`1 selector)
   在 EbcBuy.Bll.Orders.Services.Impl.ReturnOrderService.GetReturnOrderList() 位置 d:\Project_v3\EbcBuy.Bll\EbcBuy.Bll.Orders\EbcBuy.Bll.Orders.Services\Impl\ReturnOrderService.cs:行号 41
   在 EbcBuy.Bll.Orders.WebApi.Controllers.ReturnOrderController.Get() 位置 d:\Project_v3\EbcBuy.Bll\EbcBuy.Bll.Orders\EbcBuy.Bll.Order.WebApi\Controllers\ReturnOrderController.cs:行号 43
   在 lambda_method(Closure , Object , Object[] )
   在 System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)
   在 System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)
   在 System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
=================================================================
{"客户端和服务之间的类型不匹配。类型“EbcBuy.Bll.Orders.Models.ReturnOrder”不是实体类型,但是响应负载中的类型表示实体类型。请确保在客户端上定义的类型与服务的数据模型匹配,或更新客户端上的服务引用。"}

在 System.Data.Services.Client.DataServiceRequest.Execute[TElement](DataServiceContext context, QueryComponents queryComponents)
   在 System.Data.Services.Client.DataServiceQuery`1.Execute()
   在 System.Data.Services.Client.DataServiceQuery`1.GetEnumerator()
   在 System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   在 System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   在 EbcBuy.Bll.Orders.UnitTest.ODataClient.Test() 位置 d:\Project_v3\EbcBuy.Bll\EbcBuy.Bll.Orders\EbcBuy.Bll.Orders.UnitTest\ODataClient.cs:行号 17
   在 EbcBuy.Bll.Orders.UnitTest.Program.Main(String[] args) 位置 d:\Project_v3\EbcBuy.Bll\EbcBuy.Bll.Orders\EbcBuy.Bll.Orders.UnitTest\Program.cs:行号 18
   在 System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   在 System.Threading.ThreadHelper.ThreadStart()

=======================================================
{"未能加载文件或程序集“Microsoft.Data.Edm, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)":"Microsoft.Data.Edm, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"}

在 System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   在 System.Reflection.RuntimeModule.GetTypes()
   在 System.Reflection.Assembly.GetTypes()
   在 System.ComponentModel.Composition.Hosting.AssemblyCatalog.get_InnerCatalog()
   在 System.ComponentModel.Composition.Hosting.AssemblyCatalog.GetExports(ImportDefinition definition)
   在 System.ComponentModel.Composition.Hosting.DirectoryCatalog.<>c__DisplayClass3.<GetExports>b__2(ComposablePartCatalog catalog)
   在 System.Linq.Enumerable.<SelectManyIterator>d__14`2.MoveNext()
   在 System.ComponentModel.Composition.Hosting.CatalogExportProvider.InternalGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
   在 System.ComponentModel.Composition.Hosting.CatalogExportProvider.InnerCatalogExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
   在 System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
   在 System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
   在 System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
   在 System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition, AtomicComposition atomicComposition)
   在 System.ComponentModel.Composition.Hosting.AggregateExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
   在 System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
   在 System.ComponentModel.Composition.Hosting.CompositionContainer.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
   在 System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
   在 System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition, AtomicComposition atomicComposition)
   在 System.ComponentModel.Composition.Hosting.ExportProvider.GetExportsCore(Type type, Type metadataViewType, String contractName, ImportCardinality cardinality)
   在 System.ComponentModel.Composition.Hosting.ExportProvider.GetExportedValuesCore[T](String contractName)
   在 System.ComponentModel.Composition.Hosting.ExportProvider.GetExportedValues[T](String contractName)
   在 EbcBuy.Dal.Orders.Data.Initialize.EFDbContextOrders.get_EntityMappers() 位置 d:\Project_v3\EbcBuy.Dal\EbcBuy.Dal.Orders\EbcBuy.Dal.Orders.Data\Initialize\EFDbContextOrders.cs:行号 36
   在 Quick.Framework.Data.EFDbContext.OnModelCreating(DbModelBuilder modelBuilder) 位置 d:\Project_v3\Quick.Framework\Quick.Framework.Data\EFDbContext.cs:行号 26
   在 System.Data.Entity.DbContext.CallOnModelCreating(DbModelBuilder modelBuilder)
   在 System.Data.Entity.Internal.LazyInternalContext.CreateModelBuilder()
   在 System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)
   在 System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input)
==========================================================
"{\"Message\":\"未找到与请求 URI“http://localhost:39380/api/ReturnOrder()/$count”匹配的 HTTP 资源。\",\"MessageDetail\":\"未找到与名为“ReturnOrder()”的控制器匹配的类型。\"}"

====================================================
"<!DOCTYPE html>\r\n<html>\r\n    <head>\r\n        <title>未能加载文件或程序集“Microsoft.Data.Services.Client”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)</title>\r\n        <meta name=\"viewport\" content=\"width=device-width\" />\r\n        <style>\r\n         body {font-family:\"Verdana\";font-weight:normal;font-size: .7em;color:black;} \r\n         p {font-family:\"Verdana\";font-weight:normal;color:black;margin-top: -5px}\r\n         b {font-family:\"Verdana\";font-weight:bold;color:black;margin-top: -5px}\r\n         H1 { font-family:\"Verdana\";font-weight:normal;font-size:18pt;color:red }\r\n         H2 { font-family:\"Verdana\";font-weight:normal;font-size:14pt;color:maroon }\r\n         pre {font-family:\"Consolas\",\"Lucida Console\",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}\r\n         .marker {font-weight: bold; color: black;text-decoration: none;}\r\n         .version {color: gray;}\r\n         .error {margin-bottom: 10px;}\r\n         .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }\r\n         @media screen and (max-width: 639px) {\r\n          pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }\r\n         }\r\n         @media screen and (max-width: 479px) {\r\n          pre { width: 280px; }\r\n         }\r\n        </style>\r\n    </head>\r\n\r\n    <body bgcolor=\"white\">\r\n\r\n            <span><H1>“/”应用程序中的服务器错误。<hr width=100% size=1 color=silver></H1>\r\n\r\n            <h2> <i>未能加载文件或程序集“Microsoft.Data.Services.Client”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)</i> </h2></span>\r\n\r\n            <font face=\"Arial, Helvetica, Geneva, SunSans-Regular, sans-serif \">\r\n\r\n            <b> 说明: </b>执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。\r\n\r\n            <br><br>\r\n\r\n            <b> 异常详细信息: </b>System.IO.FileLoadException: 未能加载文件或程序集“Microsoft.Data.Services.Client”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)<br><br>\r\n\r\n            <b>源错误:</b> <br><br>\r\n\r\n            <table width=100% bgcolor=\"#ffffcc\">\r\n               <tr>\r\n                  <td>\r\n                      <code>\r\n\r\n执行当前 Web 请求期间生成了未经处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。</code>\r\n\r\n                  </td>\r\n               </tr>\r\n            </table>\r\n\r\n            <br>\r\n\r\n            <b>程序集加载跟踪:</b> 下列信息有助于确定程序集“Microsoft.Data.Services.Client”未能加载的原因。<br><br>\r\n\r\n            <table width=100% bgcolor=\"#ffffcc\">\r\n               <tr>\r\n                  <td>\r\n                      <code><pre>\r\n\r\n警告: 程序集绑定日志记录被关闭。\r\n要启用程序集绑定失败日志记录,请将注册表值 [HKLM\\Software\\Microsoft\\Fusion!EnableLog] (DWORD)设置为 1。\r\n注意: 会有一些与程序集绑定失败日志记录关联的性能损失。\r\n要关闭此功能,请移除注册表值 [HKLM\\Software\\Microsoft\\Fusion!EnableLog]。\r\n</pre></code>\r\n\r\n                  </td>\r\n               </tr>\r\n            </table>\r\n\r\n            <br>\r\n\r\n            <b>堆栈跟踪:</b> <br><br>\r\n\r\n            <table width=100% bgcolor=\"#ffffcc\">\r\n               <tr>\r\n                  <td>\r\n                      <code><pre>\r\n\r\n[FileLoadException: 未能加载文件或程序集“Microsoft.Data.Services.Client”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)]\r\n\r\n[FileLoadException: 未能加载文件或程序集“Microsoft.Data.Services.Client, Version=5.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)]\r\n   System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark&amp; stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0\r\n   System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark&amp; stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +34\r\n   System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark&amp; stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152\r\n   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark&amp; stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77\r\n   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark&amp; stackMark, Boolean forIntrospection) +16\r\n   System.Reflection.Assembly.Load(String assemblyString) +28\r\n   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38\r\n\r\n[ConfigurationErrorsException: 未能加载文件或程序集“Microsoft.Data.Services.Client, Version=5.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)]\r\n   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +752\r\n   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +218\r\n   System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130\r\n   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170\r\n   System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +91\r\n   System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean&amp; isRefAssemblyLoaded) +285\r\n   System.Web.Compilation.BuildManager.ExecutePreAppStart() +153\r\n   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516\r\n\r\n[HttpException (0x80004005): 未能加载文件或程序集“Microsoft.Data.Services.Client, Version=5.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)]\r\n   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9915300\r\n   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101\r\n   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254\r\n</pre></code>\r\n\r\n                  </td>\r\n               </tr>\r\n            </table>\r\n\r\n            <br>\r\n\r\n            <hr width=100% size=1 color=silver>\r\n\r\n            <b>版本信息:</b>&nbsp;Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.0.30319.18446\r\n\r\n            </font>\r\n\r\n    </body>\r\n</html>\r\n<!-- \r\n[FileLoadException]: 未能加载文件或程序集“Microsoft.Data.Services.Client”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)\r\n[FileLoadException]: 未能加载文件或程序集“Microsoft.Data.Services.Client, Version=5.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)\r\n   在 System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)\r\n   在 System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)\r\n   在 System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)\r\n   在 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)\r\n   在 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)\r\n   在 System.Reflection.Assembly.Load(String assemblyString)\r\n   在 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)\r\n[ConfigurationErrorsException]: 未能加载文件或程序集“Microsoft.Data.Services.Client, Version=5.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)\r\n   在 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)\r\n   在 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()\r\n   在 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai)\r\n   在 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)\r\n   在 System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies()\r\n   在 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded)\r\n   在 System.Web.Compilation.BuildManager.ExecutePreAppStart()\r\n   在 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)\r\n[HttpException]: 未能加载文件或程序集“Microsoft.Data.Services.Client, Version=5.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)\r\n   在 System.Web.HttpRuntime.FirstRequestInit(HttpContext context)\r\n   在 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)\r\n   在 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)\r\n-->"
=================================================
{
  "odata.metadata":"http://localhost:39380/odata/$metadata#ProductInfo","value":[
    {
      "ProductId":"1","ProductName":"1","MarketPrice":"1.00","PurchasePrice":"1.00","HasNormalInvoice":true,"HasSpecialInvoice":true,"SupplierName":"1","Weight":1.0,"ServiceInfo":"1","OtherInfo":"1","Policy":"1","Length":0.0,"Width":0.0,"Height":0.0,"IsDeleted":false,"CreatedUserId":null,"CreatedTime":null,"ModifiedTime":null
    }
  ]
}
===========================================================
{"无法加载在应用程序配置文件中指定的 DbConfiguration 类型“MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6”。请确保使用限定程序集的名称且该程序集对运行的应用程序可用。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkId=260883。"}

在 System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   在 System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   在 System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   在 System.Activator.CreateInstance[T]()
   在 Quick.Framework.Data.UnitOfWork`1..ctor() 位置 d:\Project_EbcBuy\Quick.Framework\Quick.Framework.Data\UnitOfWork.cs:行号 18
   在 EbcBuy.Dal.Orders.Data.Initialize.UnitContextOrders..ctor()
   在 EbcBuy.Bll.Orders.Services.Impl.ComplaintService..ctor() 位置 d:\Project_EbcBuy\EbcBuy.Bll\EbcBuy.Bll.Orders\EbcBuy.Bll.Orders.Services\Impl\ComplaintService.cs:行号 25
   在 EbcBuy.Bll.Orders.UnitTest.ComplaintServiceUT..ctor() 位置 d:\Project_EbcBuy\EbcBuy.Bll\EbcBuy.Bll.Orders\EbcBuy.Bll.Orders.UnitTest\ComplaintServiceUT.cs:行号 28
   在 EbcBuy.Bll.Orders.UnitTest.Program.Main(String[] args) 位置 d:\Project_EbcBuy\EbcBuy.Bll\EbcBuy.Bll.Orders\EbcBuy.Bll.Orders.UnitTest\Program.cs:行号 25
   在 System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   在 System.Threading.ThreadHelper.ThreadStart()

=====================
{"There is already an open DataReader associated with this Connection which must be closed first."}

在 System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
   在 System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues)
   在 System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__6()
   在 System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
   在 System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__5()
   在 System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute[TResult](Func`1 operation)
   在 System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
   在 System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()
   在 System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
   在 System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   在 System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   在 lambda_method(Closure , OrderInfo )
   在 System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   在 System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   在 System.Linq.OrderedEnumerable`1.<GetEnumerator>d__0.MoveNext()
   在 System.Linq.Enumerable.<SkipIterator>d__4d`1.MoveNext()
   在 System.Linq.Enumerable.<TakeIterator>d__3a`1.MoveNext()
   在 System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   在 System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   在 EbcBuy.Bll.Orders.Services.Impl.OrderInfoService.GetOrderList(OrderQueryModel condition, Int32 pageIndex, Int32 pageSize) 位置 d:\Project_EbcBuy\EbcBuy.Bll\EbcBuy.Bll.Orders\EbcBuy.Bll.Orders.Services\Impl\OrderInfoService.cs:行号 109
   在 EbcBuy.Bll.Orders.UnitTest.OrderInfoServiceUT.TestGetList() 位置 d:\Project_EbcBuy\EbcBuy.Bll\EbcBuy.Bll.Orders\EbcBuy.Bll.Orders.UnitTest\OrderInfoServiceUT.cs:行号 78
   在 EbcBuy.Bll.Orders.UnitTest.Program.Main(String[] args) 位置 d:\Project_EbcBuy\EbcBuy.Bll\EbcBuy.Bll.Orders\EbcBuy.Bll.Orders.UnitTest\Program.cs:行号 25
   在 System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   在 System.Threading.ThreadHelper.ThreadStart()

========================================================================
【访问http://localhost:39385/api/CustomersInfo提示:】

<m:message>
支持“EFDbContextUsers”上下文的模型已在数据库创建后发生更改。请考虑使用 Code First 迁移更新数据库(http://go.microsoft.com/fwlink/?LinkId=238269)。
</m:message>
<m:type>System.InvalidOperationException</m:type>

【我删掉数据库后,再刷新,发现又是下面的错误:】
<m:message>实体类型 CustomersInfo 不是当前上下文的模型的一部分。</m:message>
<m:type>System.InvalidOperationException</m:type>

在 System.Data.Entity.Internal.InternalContext.UpdateEntitySetMappingsForType(Type entityType)
   在 System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
   在 System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
   在 System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
   在 System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider()
   在 System.Linq.Queryable.Select[TSource,TResult](IQueryable`1 source, Expression`1 selector)
   在 EbcBuy.Bll.Users.Services.Impl.CustomersInfoService.GetCustomerList() 位置 d:\Set working folder\EbcBuy.Bll\EbcBuy.Bll.Users\EbcBuy.Bll.Users.Services\Impl\CustomersInfoService.cs:行号 29
   在 EbcBuy.Bll.Users.WebApi.Controllers.CustomersInfoController.Get() 位置 d:\Set working folder\EbcBuy.Bll\EbcBuy.Bll.Users\EbcBuy.Bll.Users.WebApi\Controllers\CustomersInfoController.cs:行号 34
   在 lambda_method(Closure , Object , Object[] )
   在 System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)
   在 System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)
   在 System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
【原因:】   跟EFDbContextUsers.cs里获取DirectoryCatalog的path有关。  宿主是控制台应用程序的,在..../bin/debug下, 宿主是Web的,在..../bin下。 如下代码:var catalog = new DirectoryCatalog((AppDomain.CurrentDomain.SetupInformation.PrivateBinPath)); 只适合宿主是web的。
如下代码可以兼顾以上2种情况:
                    var dir = AppDomain.CurrentDomain.BaseDirectory;
                    if (!dir.Contains("bin"))
                    {
                        dir += "\\bin";
                    }

使用OData技术遇到的问题及解决办法的更多相关文章

  1. Windows 10 技术预览版9926 “未知源”引起系统休眠后自启的解决办法

    问题的由来: 自从安装上了最新发布的Windows 10 ,使用起来有诸多的改进:无论是重绘的图标还是通知消息中心的整合还是更智能的OneDrive客户端都使得工作起来非常愉悦. 不过笔者这两天频繁遇 ...

  2. 【技术贴】解决myeclipse SVN 提交代码 commit:remains in tree-conflict错误的解决办法

    [技术贴]解决myeclipse SVN 提交代码 commit:remains in tree-conflict错误的解决办法 错误是:Aborting commit: xxxxx’ remains ...

  3. Dell R720上的系统安装问题的解决办法(关于RAID建立磁盘阵列的技术)

    摘要:本篇是本人在搭建大数量存储.搜索环境时,对于使用Dell PowerEdge R720 and R720xd作为服务器所遇到的一些问题进行的总结. 开始时,我们使用Dell提供的安装光盘(蓝色) ...

  4. js_html_input中autocomplete="off"在chrom中失效的解决办法 使用JS模拟锚点跳转 js如何获取url参数 C#模拟httpwebrequest请求_向服务器模拟cookie发送 实习期学到的技术(一) LinqPad的变量比较功能 ASP.NET EF 使用LinqPad 快速学习Linq

    js_html_input中autocomplete="off"在chrom中失效的解决办法 分享网上的2种办法: 1-可以在不需要默认填写的input框中设置 autocompl ...

  5. 【技术文档】XuebaOnline配环境时遇到的问题和解决办法

    在Ubuntu下装XuebaOnline可能遇到的问题和解决办法 自动安装Python3.0以上版本 编译命令采用python3 manage.py runserver,所以在linux系统下需要安装 ...

  6. Skype坑爹报错:“旧版本无法删除,请联络您的技术支持小组 ”的解决办法

    真是恶心的让人想吐的报错.现在终于解决了,跟大家分享一下方法. 先给问题截个图,如下 首先当我去搜解决办法之前,我已经在[控制面板]的[卸载程序]里把Skype删除了,真是让我后悔不已的操作啊!!因为 ...

  7. [大数据技术]Kettle报OPTION SQL_SELECT_LIMIT=DEFAULT错误的解决办法

    百度得到的解决方式都是说mysql通过jdbc链接的时候会进行测试’SET OPTION SQL_SELECT_LIMIT=DEFAULT’,但是5.6以后的版本弃用了set的方式. 我用的MySQL ...

  8. 懒加载session 无法打开 no session or session was closed 解决办法(完美解决)

           首先说明一下,hibernate的延迟加载特性(lazy).所谓的延迟加载就是当真正需要查询数据时才执行数据加载操作.因为hibernate当中支持实体对象,外键会与实体对象关联起来.如 ...

  9. PHPCMS后台密码忘记解决办法

    什么是PHPCMS? PHPCMS是一款网站管理软件.该软件采用模块化开发,支持多种分类方式,使用它可方便实现个性化网站的设计.开发与维护.它支持众多的程序组合,可轻松实现网站平台迁移,并可广泛满足各 ...

随机推荐

  1. Win10专业版激活方法可查版本

    Win10专业版激活步骤 ------安装Win10专业版,请win+R,键入winver回车,可查看版本------ 1.点击左下角windows按钮,找到设置并打开,依次点击"更新和安全 ...

  2. Linux三剑客之awk

    awk awk是linux下的一个命令,他对其他命令的输出,对文件的处理都十分强大,其实他更像一门编程语言,他可以自定义变量,有条件语句,有循环,有数组,有正则,有函数等.他读取输出,或者文件的方式是 ...

  3. JS-Dom概念

    <!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content=&q ...

  4. 根据用户IP获得所在城市

    运行以下代码即可<html> <head> <meta http-equiv="Content-Type" content="text/ht ...

  5. 时空地图TimeGIS 可编辑ArcGIS的Shape矢量文件的地理信息系统

    时空地图 TimeGIS 6.0 是一个地理信息系统软件,它可以显示网络地图,编辑ArcGIS的SHP矢量文件格式,显示NETCDF等栅格文件,管理图层等. 在它的基础上,可以二次开发各种GIS应用, ...

  6. CSS3使用AnimationEnd为同一个元素添加多个动画效果

    <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <meta name ...

  7. ubuntu 14.04 下evolution邮箱客户端设置(腾讯企业邮箱)

    安装 evolution 有PPA可用,支持 Ubuntu 14.04 及衍生系统.打开终端,输入以下命令: sudo add-apt-repository ppa:fta/gnome3 sudo a ...

  8. Python socket (多线程)

    Server 端 code import SocketServer class MyTCPHandler(SocketServer.BaseRequestHandler): ""& ...

  9. lockfree

    为什么要lockfree 按我的理解, lockfree就是不去 调用操作系统给定的锁机制. 1. 会有system call,  and system call is expensive; 比如pt ...

  10. iOS开发流程总结

    本文由社区会员umyueyue分享 以下是会员umyueue总结的iOS开发流程以及学习中的资料分享. 流程:注册.开发.真机测试.发布以及上线. iPhone iOS 4从注册到app上线开发流程 ...