zoukankan      html  css  js  c++  java
  • 使用OData技术遇到的问题及解决办法

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

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

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

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

    "<?xml version="1.0" encoding="utf-8"?> <m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">   <m:code />   <m:message xml:lang="en-US">请求无效。</m:message>   <m:innererror>     <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>     <m:type></m:type>     <m:stacktrace></m:stacktrace>   </m:innererror> </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"?> <m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">   <m:code />   <m:message xml:lang="en-US">出现错误。</m:message>   <m:innererror>     <m:message>“ObjectContent`1”类型未能序列化内容类型“application/atom+xml; charset=utf-8”的响应正文。</m:message>     <m:type>System.InvalidOperationException</m:type>     <m:stacktrace></m:stacktrace>     <m:internalexception>       <m:message>Null collections cannot be serialized.</m:message>       <m:type>System.Runtime.Serialization.SerializationException</m:type>       
    <m:stacktrace>   在 System.Web.Http.OData.Formatter.Serialization.ODataCollectionSerializer.CreateODataValue(Object graph, IEdmTypeReference expectedType, ODataSerializerContext writeContext)&#xD;    在 System.Web.Http.OData.Formatter.Serialization.ODataEdmTypeSerializer.CreateProperty(Object graph, IEdmTypeReference expectedType, String elementName, ODataSerializerContext writeContext)&#xD;    在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.CreateStructuralProperty(IEdmStructuralProperty structuralProperty, EntityInstanceContext entityInstanceContext)&#xD;    在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.CreateStructuralPropertyBag(IEnumerable`1 structuralProperties, EntityInstanceContext entityInstanceContext)&#xD;    在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.CreateEntry(SelectExpandNode selectExpandNode, EntityInstanceContext entityInstanceContext)&#xD;    在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.WriteEntry(Object graph, ODataWriter writer, ODataSerializerContext writeContext)&#xD;    在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.WriteObjectInline(Object graph, IEdmTypeReference expectedType, ODataWriter writer, ODataSerializerContext writeContext)&#xD;    在 System.Web.Http.OData.Formatter.Serialization.ODataFeedSerializer.WriteFeed(IEnumerable enumerable, IEdmTypeReference feedType, ODataWriter writer, ODataSerializerContext writeContext)&#xD;    在 System.Web.Http.OData.Formatter.Serialization.ODataFeedSerializer.WriteObjectInline(Object graph, IEdmTypeReference expectedType, ODataWriter writer, ODataSerializerContext writeContext)&#xD;    在 System.Web.Http.OData.Formatter.Serialization.ODataFeedSerializer.WriteObject(Object graph, Type type, ODataMessageWriter messageWriter, ODataSerializerContext writeContext)&#xD;    在 System.Web.Http.OData.Formatter.ODataMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, HttpContent content, HttpContentHeaders contentHeaders)&#xD;    在 System.Web.Http.OData.Formatter.ODataMediaTypeFormatter.WriteToStreamAsync(Type type, Object value, Stream writeStream, HttpContent content, TransportContext transportContext, CancellationToken cancellationToken)&#xD; --- 引发异常的上一位置中堆栈跟踪的末尾 ---&#xD;    在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#xD;    在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#xD;    在 System.Web.Http.WebHost.HttpControllerHandler.&lt;WriteBufferedResponseContentAsync&gt;d__1b.MoveNext()</m:stacktrace>     </m:internalexception>   </m:innererror> </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"?> <m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">   <m:code />   <m:message xml:lang="en-US">出现错误。</m:message>   <m:innererror>     <m:message>“ObjectContent`1”类型未能序列化内容类型“application/atom+xml; charset=utf-8”的响应正文。</m:message>     <m:type>System.InvalidOperationException</m:type>     <m:stacktrace></m:stacktrace>     <m:internalexception>       <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.&#xD; 参数名: navigationProperty</m:message>       <m:type>System.ArgumentException</m:type>       <m:stacktrace>   在 System.Web.Http.OData.Builder.EntitySetLinkBuilderAnnotation.BuildNavigationLink(EntityInstanceContext instanceContext, IEdmNavigationProperty navigationProperty, ODataMetadataLevel metadataLevel)&#xD;    在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.CreateNavigationLink(IEdmNavigationProperty navigationProperty, EntityInstanceContext entityInstanceContext)&#xD;    在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.&lt;CreateNavigationLinks&gt;d__1.MoveNext()&#xD;    在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.WriteNavigationLinks(IEnumerable`1 navigationProperties, EntityInstanceContext entityInstanceContext, ODataWriter writer)&#xD;    在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.WriteEntry(Object graph, ODataWriter writer, ODataSerializerContext writeContext)&#xD;    在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.WriteObjectInline(Object graph, IEdmTypeReference expectedType, ODataWriter writer, ODataSerializerContext writeContext)&#xD;    在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.WriteObject(Object graph, Type type, ODataMessageWriter messageWriter, ODataSerializerContext writeContext)&#xD;    在 System.Web.Http.OData.Formatter.ODataMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, HttpContent content, HttpContentHeaders contentHeaders)&#xD;    在 System.Web.Http.OData.Formatter.ODataMediaTypeFormatter.WriteToStreamAsync(Type type, Object value, Stream writeStream, HttpContent content, TransportContext transportContext, CancellationToken cancellationToken)&#xD; --- 引发异常的上一位置中堆栈跟踪的末尾 ---&#xD;    在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#xD;    在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#xD;    在 System.Web.Http.WebHost.HttpControllerHandler.&lt;WriteBufferedResponseContentAsync&gt;d__1b.MoveNext()</m:stacktrace>     </m:internalexception>   </m:innererror> </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":"u7fe0u8d1du5361u4e0au8863","MainPic":"this is a url here.","SkuId":123111,"SkuName":"u9ad8u8c03u7ea2"
      },"OrderId":"123","ServiceType":1,"FreightPayType":1,"AskQuantity":1,"ReturnMoney":"1120.00","ProblemDisc":"model.ProblemDisc","CustomerId":"111","CustomerName":"u6d4bu8bd5CustomerName","ShopId":"111","ShopName":"u6d4bu8bd5ShopName","TheStatus":1
    }

    【否则是】:
    {
      "odata.metadata":"http://localhost:39380/odata/$metadata#ReturnOrder/@Element","ReturnOrderId":"1406271033590870","ReturnOrderType":0,"Product":{
        "ProductId":"123","ProductName":"u7fe0u8d1du5361u4e0au8863","MainPic":"this is a url here.","SkuId":123111,"SkuName":"u9ad8u8c03u7ea2"
      },"OrderId":"123","ServiceType":1,"FreightPayType":1,"AskQuantity":1,"ReturnMoney":"1120.00","ProblemDisc":"model.ProblemDisc","CustomerId":"111","CustomerName":"u6d4bu8bd5CustomerName","CustomerContactInfo":{
        "ProvinceId":0,"ProvinceName":"Hebei","CityId":0,"CityName":"Tangshan","CountyId":0,"CountyName":"Fengrun","Address":"u5317u4eacu897fu5b89u9633u4e1c18:0921:5303:44u5f53u65e5u5230u8fbe","ZipCode":"100100","LinkMan":"u6bd4u5c14u76d6u8328","Telephone":null,"MobilePhone":"18233334444","EMail":null
      },"ShopId":"111","ShopName":"u6d4bu8bd5ShopName","ShopContactInfo":{
        "ProvinceId":0,"ProvinceName":"Hebei","CityId":0,"CityName":"Tangshan","CountyId":0,"CountyName":"Fengrun","Address":"u5317u4eacu897fu5b89u9633u4e1c18:0921:5303:44u5f53u65e5u5230u8fbe","ZipCode":"100100","LinkMan":"u6bd4u5c14u76d6u8328","Telephone":null,"MobilePhone":"18233334444","EMail":null
      },"TheStatus":1
    }

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


    "<?xml version="1.0" encoding="utf-8"?> <m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">   <m:code />   <m:message xml:lang="en-US">出现错误。</m:message>   <m:innererror>     <m:message>“ObjectContent`1”类型未能序列化内容类型“application/atom+xml; charset=utf-8”的响应正文。</m:message>     <m:type>System.InvalidOperationException</m:type>     <m:stacktrace></m:stacktrace>     <m:internalexception>       <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.&#xD; 参数名: navigationProperty</m:message>

    ============================================
    "<?xml version="1.0" encoding="utf-8"?> <m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">   <m:code />   <m:message xml:lang="en-US">出现错误。</m:message>   <m:innererror>     <m:message>执行命令定义时出错。有关详细信息,请参阅内部异常。</m:message>     <m:type>System.Data.Entity.Core.EntityCommandExecutionException</m:type>     <m:stacktrace>   在 System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)&#xD;    在 System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues)&#xD;    在 System.Data.Entity.Core.Objects.ObjectQuery`1.&lt;&gt;c__DisplayClass7.&lt;GetResults&gt;b__6()&#xD;    在 System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)&#xD;    在 System.Data.Entity.Core.Objects.ObjectQuery`1.&lt;&gt;c__DisplayClass7.&lt;GetResults&gt;b__5()&#xD;    在 System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute[TResult](Func`1 operation)&#xD;    在 System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)&#xD;    在 System.Data.Entity.Core.Objects.ObjectQuery`1.&lt;System.Collections.Generic.IEnumerable&lt;T&gt;.GetEnumerator&gt;b__0()&#xD;    在 System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()&#xD;    在 System.Web.Http.QueryableAttribute.SingleOrDefault(IQueryable queryable, HttpActionDescriptor actionDescriptor)&#xD;    在 System.Web.Http.QueryableAttribute.ExecuteQuery(Object response, HttpRequestMessage request, HttpActionDescriptor actionDescriptor)&#xD;    在 System.Web.Http.QueryableAttribute.OnActionExecuted(HttpActionExecutedContext actionExecutedContext)&#xD;    在 System.Web.Http.Filters.ActionFilterAttribute.OnActionExecutedAsync(HttpActionExecutedContext actionExecutedContext, CancellationToken cancellationToken)&#xD; --- 引发异常的上一位置中堆栈跟踪的末尾 ---&#xD;    在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#xD;    在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#xD;    在 System.Web.Http.Filters.ActionFilterAttribute.&lt;CallOnActionExecutedAsync&gt;d__5.MoveNext()&#xD; --- 引发异常的上一位置中堆栈跟踪的末尾 ---&#xD;    在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#xD;    在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#xD;    在 System.Web.Http.Filters.ActionFilterAttribute.&lt;ExecuteActionFilterAsyncCore&gt;d__0.MoveNext()&#xD; --- 引发异常的上一位置中堆栈跟踪的末尾 ---&#xD;    在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#xD;    在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#xD;    在 System.Web.Http.Controllers.ActionFilterResult.&lt;ExecuteAsync&gt;d__2.MoveNext()&#xD; --- 引发异常的上一位置中堆栈跟踪的末尾 ---&#xD;    在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#xD;    在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#xD;    在 System.Web.Http.Dispatcher.HttpControllerDispatcher.&lt;SendAsync&gt;d__0.MoveNext()</m:stacktrace>     <m:internalexception>       <m:message>There is already an open DataReader associated with this Connection which must be closed first.</m:message>       <m:type>MySql.Data.MySqlClient.MySqlException</m:type>       <m:stacktrace>   在 MySql.Data.MySqlClient.ExceptionInterceptor.Throw(Exception exception)&#xD;    在 MySql.Data.MySqlClient.MySqlConnection.Throw(Exception ex)&#xD;    在 MySql.Data.MySqlClient.MySqlCommand.CheckState()&#xD;    在 MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)&#xD;    在 MySql.Data.Entity.EFMySqlCommand.ExecuteDbDataReader(CommandBehavior behavior)&#xD;    在 System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)&#xD;    在 System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.&lt;Reader&gt;b__c(DbCommand t, DbCommandInterceptionContext`1 c)&#xD;    在 System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)&#xD;    在 System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)&#xD;    在 System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavior behavior)&#xD;    在 System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)&#xD;    在 System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)</m:stacktrace>     </m:internalexception>   </m:innererror> </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> <html>     <head>         <title>分析器错误</title>         <meta name="viewport" content="width=device-width" />         <style>          body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}          p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}          b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}          H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }          H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }          pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}          .marker {font-weight: bold; color: black;text-decoration: none;}          .version {color: gray;}          .error {margin-bottom: 10px;}          .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }          @media screen and (max- 639px) {           pre { 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }          }          @media screen and (max- 479px) {           pre { 280px; }          }         </style>     </head>     <body bgcolor="white">             <span><H1>“/”应用程序中的服务器错误。<hr width=100% size=1 color=silver></H1>             <h2> <i>分析器错误</i> </h2></span>             <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">             <b> 说明: </b>在分析向此请求提供服务所需资源时出错。请检查下列特定分析错误详细信息并适当地修改源文件。             <br><br>             <b> 分析器错误消息: </b>未能加载类型“EbcBuy.Bll.Order.WebApi.WebApiApplication”。<br><br>             <b>源错误:</b> <br><br>             <table width=100% bgcolor="#ffffcc">                <tr>                   <td>                       <code><pre> <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; </font></pre></code>                   </td>                </tr>             </table>             <br>             <b> 源文件: </b> /global.asax<b> &nbsp;&nbsp; 行: </b> 1             <br><br>             <hr width=100% size=1 color=silver>             <b>版本信息:</b>&nbsp;Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.0.30319.18446             </font>     </body> </html> <!-- [HttpException]: 未能加载类型“EbcBuy.Bll.Order.WebApi.WebApiApplication”。    在 System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError)    在 System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly)    在 System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData) [HttpParseException]: 未能加载类型“EbcBuy.Bll.Order.WebApi.WebApiApplication”。    在 System.Web.UI.TemplateParser.ProcessException(Exception ex)    在 System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)    在 System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) [HttpParseException]: 未能加载类型“EbcBuy.Bll.Order.WebApi.WebApiApplication”。    在 System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)    在 System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath)    在 System.Web.UI.TemplateParser.ParseInternal()    在 System.Web.UI.TemplateParser.Parse()    在 System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType()    在 System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)    在 System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()    在 System.Web.Compilation.BuildProvidersCompiler.PerformBuild()    在 System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp)    在 System.Web.Compilation.BuildManager.CompileGlobalAsax()    在 System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() [HttpException]: 未能加载类型“EbcBuy.Bll.Order.WebApi.WebApiApplication”。    在 System.Web.Compilation.BuildManager.ReportTopLevelCompilationException()    在 System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled()    在 System.Web.Compilation.BuildManager.CallAppInitializeMethod()    在 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) [HttpException]: 未能加载类型“EbcBuy.Bll.Order.WebApi.WebApiApplication”。    在 System.Web.HttpRuntime.FirstRequestInit(HttpContext context)    在 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)    在 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) -->"

    =============================================
    "<?xml version="1.0" encoding="utf-8"?> <m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">   <m:code />   <m:message xml:lang="en-US">出现错误。</m:message>   <m:innererror>     <m:message>“ObjectContent`1”类型未能序列化内容类型“application/atom+xml; charset=utf-8”的响应正文。</m:message>     <m:type>System.InvalidOperationException</m:type>     <m:stacktrace></m:stacktrace>     <m:internalexception>       <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.&#xD; 参数名: navigationProperty</m:message>       <m:type>System.ArgumentException</m:type>       <m:stacktrace>   在 System.Web.Http.OData.Builder.EntitySetLinkBuilderAnnotation.BuildNavigationLink(EntityInstanceContext instanceContext, IEdmNavigationProperty navigationProperty, ODataMetadataLevel metadataLevel)&#xD;    在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.CreateNavigationLink(IEdmNavigationProperty navigationProperty, EntityInstanceContext entityInstanceContext)&#xD;    在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.&lt;CreateNavigationLinks&gt;d__1.MoveNext()&#xD;    在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.WriteNavigationLinks(IEnumerable`1 navigationProperties, EntityInstanceContext entityInstanceContext, ODataWriter writer)&#xD;    在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.WriteEntry(Object graph, ODataWriter writer, ODataSerializerContext writeContext)&#xD;    在 System.Web.Http.OData.Formatter.Serialization.ODataEntityTypeSerializer.WriteObjectInline(Object graph, IEdmTypeReference expectedType, ODataWriter writer, ODataSerializerContext writeContext)&#xD;    在 System.Web.Http.OData.Formatter.Serialization.ODataFeedSerializer.WriteFeed(IEnumerable enumerable, IEdmTypeReference feedType, ODataWriter writer, ODataSerializerContext writeContext)&#xD;    在 System.Web.Http.OData.Formatter.Serialization.ODataFeedSerializer.WriteObjectInline(Object graph, IEdmTypeReference expectedType, ODataWriter writer, ODataSerializerContext writeContext)&#xD;    在 System.Web.Http.OData.Formatter.Serialization.ODataFeedSerializer.WriteObject(Object graph, Type type, ODataMessageWriter messageWriter, ODataSerializerContext writeContext)&#xD;    在 System.Web.Http.OData.Formatter.ODataMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, HttpContent content, HttpContentHeaders contentHeaders)&#xD;    在 System.Web.Http.OData.Formatter.ODataMediaTypeFormatter.WriteToStreamAsync(Type type, Object value, Stream writeStream, HttpContent content, TransportContext transportContext, CancellationToken cancellationToken)&#xD; --- 引发异常的上一位置中堆栈跟踪的末尾 ---&#xD;    在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#xD;    在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#xD;    在 System.Web.Http.WebHost.HttpControllerHandler.&lt;WriteBufferedResponseContentAsync&gt;d__1b.MoveNext()</m:stacktrace>     </m:internalexception>   </m:innererror> </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_v3EbcBuy.BllEbcBuy.Bll.UsersEbcBuy.Bll.Users.TestOrderODataClientTest.cs:行号 17
       在 EbcBuy.Bll.Users.Test.Program.Main(String[] args) 位置 d:Project_v3EbcBuy.BllEbcBuy.Bll.UsersEbcBuy.Bll.Users.TestProgram.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_v3EbcBuy.BllEbcBuy.Bll.OrdersEbcBuy.Bll.Orders.ServicesImplReturnOrderService.cs:行号 41
       在 EbcBuy.Bll.Orders.WebApi.Controllers.ReturnOrderController.Get() 位置 d:Project_v3EbcBuy.BllEbcBuy.Bll.OrdersEbcBuy.Bll.Order.WebApiControllersReturnOrderController.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_v3EbcBuy.BllEbcBuy.Bll.OrdersEbcBuy.Bll.Orders.UnitTestODataClient.cs:行号 17
       在 EbcBuy.Bll.Orders.UnitTest.Program.Main(String[] args) 位置 d:Project_v3EbcBuy.BllEbcBuy.Bll.OrdersEbcBuy.Bll.Orders.UnitTestProgram.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_v3EbcBuy.DalEbcBuy.Dal.OrdersEbcBuy.Dal.Orders.DataInitializeEFDbContextOrders.cs:行号 36
       在 Quick.Framework.Data.EFDbContext.OnModelCreating(DbModelBuilder modelBuilder) 位置 d:Project_v3Quick.FrameworkQuick.Framework.DataEFDbContext.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> <html>     <head>         <title>未能加载文件或程序集“Microsoft.Data.Services.Client”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)</title>         <meta name="viewport" content="width=device-width" />         <style>          body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}          p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}          b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}          H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }          H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }          pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}          .marker {font-weight: bold; color: black;text-decoration: none;}          .version {color: gray;}          .error {margin-bottom: 10px;}          .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }          @media screen and (max- 639px) {           pre { 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }          }          @media screen and (max- 479px) {           pre { 280px; }          }         </style>     </head>     <body bgcolor="white">             <span><H1>“/”应用程序中的服务器错误。<hr width=100% size=1 color=silver></H1>             <h2> <i>未能加载文件或程序集“Microsoft.Data.Services.Client”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)</i> </h2></span>             <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">             <b> 说明: </b>执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。             <br><br>             <b> 异常详细信息: </b>System.IO.FileLoadException: 未能加载文件或程序集“Microsoft.Data.Services.Client”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)<br><br>             <b>源错误:</b> <br><br>             <table width=100% bgcolor="#ffffcc">                <tr>                   <td>                       <code> 执行当前 Web 请求期间生成了未经处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。</code>                   </td>                </tr>             </table>             <br>             <b>程序集加载跟踪:</b> 下列信息有助于确定程序集“Microsoft.Data.Services.Client”未能加载的原因。<br><br>             <table width=100% bgcolor="#ffffcc">                <tr>                   <td>                       <code><pre> 警告: 程序集绑定日志记录被关闭。 要启用程序集绑定失败日志记录,请将注册表值 [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD)设置为 1。 注意: 会有一些与程序集绑定失败日志记录关联的性能损失。 要关闭此功能,请移除注册表值 [HKLM\Software\Microsoft\Fusion!EnableLog]。 </pre></code>                   </td>                </tr>             </table>             <br>             <b>堆栈跟踪:</b> <br><br>             <table width=100% bgcolor="#ffffcc">                <tr>                   <td>                       <code><pre> [FileLoadException: 未能加载文件或程序集“Microsoft.Data.Services.Client”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)] [FileLoadException: 未能加载文件或程序集“Microsoft.Data.Services.Client, Version=5.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)]    System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark&amp; stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0    System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark&amp; stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +34    System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark&amp; stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152    System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark&amp; stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77    System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark&amp; stackMark, Boolean forIntrospection) +16    System.Reflection.Assembly.Load(String assemblyString) +28    System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38 [ConfigurationErrorsException: 未能加载文件或程序集“Microsoft.Data.Services.Client, Version=5.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)]    System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +752    System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +218    System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130    System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170    System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +91    System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean&amp; isRefAssemblyLoaded) +285    System.Web.Compilation.BuildManager.ExecutePreAppStart() +153    System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516 [HttpException (0x80004005): 未能加载文件或程序集“Microsoft.Data.Services.Client, Version=5.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)]    System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9915300    System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101    System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254 </pre></code>                   </td>                </tr>             </table>             <br>             <hr width=100% size=1 color=silver>             <b>版本信息:</b>&nbsp;Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.0.30319.18446             </font>     </body> </html> <!-- [FileLoadException]: 未能加载文件或程序集“Microsoft.Data.Services.Client”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040) [FileLoadException]: 未能加载文件或程序集“Microsoft.Data.Services.Client, Version=5.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)    在 System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)    在 System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)    在 System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)    在 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)    在 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)    在 System.Reflection.Assembly.Load(String assemblyString)    在 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) [ConfigurationErrorsException]: 未能加载文件或程序集“Microsoft.Data.Services.Client, Version=5.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)    在 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)    在 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()    在 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai)    在 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)    在 System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies()    在 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded)    在 System.Web.Compilation.BuildManager.ExecutePreAppStart()    在 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) [HttpException]: 未能加载文件或程序集“Microsoft.Data.Services.Client, Version=5.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)    在 System.Web.HttpRuntime.FirstRequestInit(HttpContext context)    在 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)    在 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) -->"
    =================================================
    {
      "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_EbcBuyQuick.FrameworkQuick.Framework.DataUnitOfWork.cs:行号 18
       在 EbcBuy.Dal.Orders.Data.Initialize.UnitContextOrders..ctor()
       在 EbcBuy.Bll.Orders.Services.Impl.ComplaintService..ctor() 位置 d:Project_EbcBuyEbcBuy.BllEbcBuy.Bll.OrdersEbcBuy.Bll.Orders.ServicesImplComplaintService.cs:行号 25
       在 EbcBuy.Bll.Orders.UnitTest.ComplaintServiceUT..ctor() 位置 d:Project_EbcBuyEbcBuy.BllEbcBuy.Bll.OrdersEbcBuy.Bll.Orders.UnitTestComplaintServiceUT.cs:行号 28
       在 EbcBuy.Bll.Orders.UnitTest.Program.Main(String[] args) 位置 d:Project_EbcBuyEbcBuy.BllEbcBuy.Bll.OrdersEbcBuy.Bll.Orders.UnitTestProgram.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_EbcBuyEbcBuy.BllEbcBuy.Bll.OrdersEbcBuy.Bll.Orders.ServicesImplOrderInfoService.cs:行号 109
       在 EbcBuy.Bll.Orders.UnitTest.OrderInfoServiceUT.TestGetList() 位置 d:Project_EbcBuyEbcBuy.BllEbcBuy.Bll.OrdersEbcBuy.Bll.Orders.UnitTestOrderInfoServiceUT.cs:行号 78
       在 EbcBuy.Bll.Orders.UnitTest.Program.Main(String[] args) 位置 d:Project_EbcBuyEbcBuy.BllEbcBuy.Bll.OrdersEbcBuy.Bll.Orders.UnitTestProgram.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 folderEbcBuy.BllEbcBuy.Bll.UsersEbcBuy.Bll.Users.ServicesImplCustomersInfoService.cs:行号 29
       在 EbcBuy.Bll.Users.WebApi.Controllers.CustomersInfoController.Get() 位置 d:Set working folderEbcBuy.BllEbcBuy.Bll.UsersEbcBuy.Bll.Users.WebApiControllersCustomersInfoController.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";
                        }

  • 相关阅读:
    DEVOPS技术实践_02:jenkins自动构建项目
    DEVOPS技术实践_01:jenkins集成平台
    nginx和keeplive实现负载均衡高可用
    web简易MP3播放插件 Aplayer篇章一
    龙珠MAD-视频列表(收集更新)
    使用咪咕云做C站视频直链源
    自翻唱龙珠超OP2【限界突破X幸存者】
    龙珠超的新OP【限界突破×サバイバー】
    [盘点]现今热门的h5网游
    一个简单的“贪吃蛇”小游戏
  • 原文地址:https://www.cnblogs.com/buguge/p/3858998.html
Copyright © 2011-2022 走看看