Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Entity framework 添加迁移:用于';System.Net.ServicePointManager';抛出异常_Entity Framework_Ef Code First_Azure Mobile Services_Entity Framework Migrations - Fatal编程技术网

Entity framework 添加迁移:用于';System.Net.ServicePointManager';抛出异常

Entity framework 添加迁移:用于';System.Net.ServicePointManager';抛出异常,entity-framework,ef-code-first,azure-mobile-services,entity-framework-migrations,Entity Framework,Ef Code First,Azure Mobile Services,Entity Framework Migrations,我正在尝试在Azure移动服务中进行实体框架代码优先迁移。我让项目在本地运行,并将此新类添加到我的模型中: 使用Microsoft.WindowsAzure.Mobile.Service; 使用制度; 命名空间VCollectAPI.DataObjects { 公共类标记编辑:EntityData { 公共字符串EditedTagId{get;set;} 公共字符串源标记名{get;set;} 公共字符串结果标记名{get;set;} public DateTime TimeOfEdit{get

我正在尝试在Azure移动服务中进行实体框架代码优先迁移。我让项目在本地运行,并将此新类添加到我的模型中:

使用Microsoft.WindowsAzure.Mobile.Service;
使用制度;
命名空间VCollectAPI.DataObjects
{
公共类标记编辑:EntityData
{
公共字符串EditedTagId{get;set;}
公共字符串源标记名{get;set;}
公共字符串结果标记名{get;set;}
public DateTime TimeOfEdit{get;set;}
}
}
我还将此属性添加到VCollectAPIContext:DbContext类中

public DbSet TagEdits{get;set;}
并在我的TagDomainManager:EntityDomainManager类中添加一行

if(changedItems.Contains(“Name”))
{
_context.TagEdits.Add(新TagEdit{EditedTagId=current.Id,SourceTagName=current.Name,ResultingTagName=update.Name,TimeOfEdit=DateTime.UtcNow});
current.Name=update.Name;
}
然后在PMC(PackageManager控制台)上运行命令

Add Migration RecordingTagEdits-Verbose

我希望迁移能够通过模式更新来添加新表。相反,我得到了错误“System.Net.ServicePointManager的类型初始值设定项引发了异常。”

我做错了什么?我如何修复它

完整的错误跟踪是:

System.TypeInitializationException:的类型初始值设定项 “System.Net.ServicePointManager”引发了异常。--> System.TypeInitializationException:的类型初始值设定项 “System.Net.ComNetOS”引发了异常。--> System.Configuration.ConfigurationErrorsException:元素 在本节中只能出现一次。 (C:\TFS\HXDMSRC\VisualCollections\Development\VCollectAPI\tmp140.tmp 第16行)在 System.Configuration.BaseConfigurationRecord.EvaluateOne(字符串[]) 键,分区输入,布尔值不受信任,FactoryRecord factoryRecord、SectionRecord、Object parentResult)位于 System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord、SectionRecord、Object parentResult、, 布尔getLkg,布尔getRuntimeObject,对象和结果,对象& resultRuntimeObject)位于 System.Configuration.BaseConfigurationRecord.GetSectionRecursive(字符串 configKey,Boolean getLkg,Boolean checkPermission,Boolean getRuntimeObject,布尔请求服务器,对象和结果,对象& resultRuntimeObject)位于 System.Configuration.BaseConfigurationRecord.GetSectionRecursive(字符串 configKey,Boolean getLkg,Boolean checkPermission,Boolean getRuntimeObject,布尔请求服务器,对象和结果,对象& resultRuntimeObject)位于 System.Configuration.BaseConfigurationRecord.GetSectionRecursive(字符串 configKey,Boolean getLkg,Boolean checkPermission,Boolean getRuntimeObject,布尔请求服务器,对象和结果,对象& resultRuntimeObject)位于 System.Configuration.BaseConfigurationRecord.GetSection(字符串 配置密钥)在 System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IIInternalConfigSystem.GetSection(字符串 部门名称)在 System.Configuration.ConfigurationManager.GetSection(字符串 部门名称)在 System.Configuration.PrivilegedConfiguration Manager.GetSection(字符串 部门名称)在 System.Diagnostics.DiagnosticsConfiguration.Initialize()位于 System.Diagnostics.DiagnosticsConfiguration.get_Sources()位于 System.Diagnostics.TraceSource.Initialize()位于 System.Net.Logging.InitializeLogging()位于 System.Net.Logging.get_On()位于System.Net.ComNetOS..cctor()上--- 内部异常堆栈跟踪的结束---at System.Net.ServicePointManager..cctor()---内部异常结束 堆栈跟踪--at System.Net.ServicePointManager.ensureStrongCryptoSettingsSinitalized() 在 Microsoft.VisualStudio.Platform.VsAppDomainManager.InitializeNewDomain(AppDomainSetup appDomainInfo)位于System.AppDomain.CreateAppDomainManager()处 System.AppDomain.Setup(对象参数)位于 System.AppDomain.nCreateDomain(字符串friendlyName,AppDomainSetup 设置,证据提供安全信息,证据创建者安全信息, IntPtr parentSecurityDescriptor)位于 System.AppDomainManager.CreateDomainHelper(字符串friendlyName, 证据安全信息,AppDomainSetup appDomainInfo)位于 System.AppDomainManager.CreateDomain(字符串friendlyName,证据 securityInfo,AppDomainSetup appDomainInfo)位于 System.AppDomain.InternalCreateDomain(字符串friendlyName,证据 安全信息,AppDomainSetup信息)位于 System.AppDomain.CreateDomain(字符串friendlyName,证据 安全信息,AppDomainSetup信息)位于 System.Data.Entity.Migrations.Design.ToolingFacade..ctor(字符串 migrationsAssemblyName,字符串contextAssemblyName,字符串 配置类型名称,字符串工作目录,字符串 configurationFilePath、字符串dataDirectory、DbConnectionInfo 连接stringinfo)在 System.Data.Entity.Migrations.MigrationsDomainCommand.GetFacade(字符串 configurationTypeName,布尔值useContextWorkingDirectory)位于 System.Data.Entity.Migrations.AddMigrationCommand.Execute(字符串名称, 布尔力,布尔信号变化)在 System.Data.Entity.Migrations.AddMigrationCommand.c__DisplayClass2.b__0() 在 System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(操作 命令)System.Net.ServicePointManager的类型初始值设定项 抛出了一个异常


检查web.config,可能有一些参数重复。

我出现了下一个内部异常,这意味着我的
连接字符串
部分高于
配置部分


每个配置文件只允许一个元素,如果存在,则必须是根元素的第一个子元素

太棒了!这帮了我100%