开发者社区> 问答> 正文

阿里云共享虚机 不支持code first

环境:asp.net mvc .net4.5

EF code first 程序部署到阿里云虚机上出错,本机上是没有问题的,错误提示:“无法检查模型兼容性,因为数据库不包含模型元数据。只能检查使用 Code First 或 Code First 迁移创建的数据库的模型兼容性。”

具体错误如下:
This XML file does not appear to have any style information associated with it. The document tree is shown below.

出现错误。

“ObjectContent`1”类型未能序列化内容类型“application/xml; charset=utf-8”的响应正文。

System.InvalidOperationException


出现错误。

无法检查模型兼容性,因为数据库不包含模型元数据。只能检查使用 Code First 或 Code First 迁移创建的数据库的模型兼容性。

System.NotSupportedException

在 System.Data.Entity.Internal.ModelCompatibilityChecker.CompatibleWithModel(InternalContext internalContext, ModelHashCalculator modelHashCalculator, Boolean throwIfNoMetadata, DatabaseExistenceState existenceState) 在 System.Data.Entity.Internal.InternalContext.CompatibleWithModel(Boolean throwIfNoMetadata, DatabaseExistenceState existenceState) 在 System.Data.Entity.DropCreateDatabaseIfModelChanges1.InitializeDatabase(TContext context) 在 System.Data.Entity.Internal.InternalContext.<>c__DisplayClassf1.b__e() 在 System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) 在 System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization() 在 System.Data.Entity.Internal.LazyInternalContext.b__4(InternalContext c) 在 System.Data.Entity.Internal.RetryAction1.PerformAction(TInput input) 在 System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action1 action) 在 System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase() 在 System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) 在 System.Data.Entity.Internal.Linq.InternalSet1.Initialize() 在 System.Data.Entity.Internal.Linq.InternalSet1.GetEnumerator() 在 System.Data.Entity.Infrastructure.DbQuery`1.System.Collections.Generic.IEnumerable.GetEnumerator() 在 WriteArrayOfHouseToXml(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext , CollectionDataContract ) 在 System.Runtime.Serialization.CollectionDataContract.WriteXmlValue(XmlWriterDelegator xmlWriter, Object obj, XmlObjectSerializerWriteContext context) 在 System.Runtime.Serialization.XmlObjectSerializerWriteContext.WriteDataContractValue(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle) 在 System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithoutXsiType(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle) 在 System.Runtime.Serialization.DataContractSerializer.InternalWriteObjectContent(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver) 在 System.Runtime.Serialization.DataContractSerializer.InternalWriteObject(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver) 在 System.Runtime.Serialization.XmlObjectSerializer.WriteObjectHandleExceptions(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver) 在 System.Runtime.Serialization.DataContractSerializer.WriteObject(XmlWriter writer, Object graph) 在 System.Net.Http.Formatting.XmlMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, HttpContent content) 在 System.Net.Http.Formatting.XmlMediaTypeFormatter.WriteToStreamAsync(Type type, Object value, Stream writeStream, HttpContent content, TransportContext transportContext, CancellationToken cancellationToken) --- End of stack trace from previous location where exception was thrown --- 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 在 System.Web.Http.WebHost.HttpControllerHandler.d__1b.MoveNext()


错误地址:wwww.iflve.com/api/houses

展开
收起
废材哥哥 2016-12-14 10:54:47 3678 0
1 条回答
写回答
取消 提交回答
  • 阿里云论坛版主,QQ 1978638808

    换ecs

    2019-07-17 20:33:50
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
阿里云云原生 Serverless 技术实践营 PPT 演讲 立即下载
阿里云产品十月刊 立即下载
基于阿里云构建博学谷平台实时湖仓 立即下载