添加迁移:'System.Net.ServicePointManager'的类型初始化程序引发了异常

dum*_*dad 6 entity-framework ef-code-first ef-migrations azure-mobile-services

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

using Microsoft.WindowsAzure.Mobile.Service;
using System;

namespace VCollectAPI.DataObjects
{
    public class TagEdit : EntityData
    {
        public string EditedTagId { get; set; }
        public string SourceTagName { get; set; }
        public string ResultingTagName { get; set; }
        public DateTime TimeOfEdit { get; set; }
    }
}
Run Code Online (Sandbox Code Playgroud)

我还将此属性添加到我的VCollectAPIContext:DbContext类

public DbSet<TagEdit> TagEdits { get; set; }
Run Code Online (Sandbox Code Playgroud)

并在我的TagDomainManager:EntityDomainManager类中添加一行

if (changedItems.Contains("Name"))
{
    _context.TagEdits.Add(new TagEdit { EditedTagId = current.Id, SourceTagName = current.Name, ResultingTagName = update.Name, TimeOfEdit = DateTime.UtcNow });
    current.Name = update.Name;
}
Run Code Online (Sandbox Code Playgroud)

在PMC(包管理器控制台),然后运行该命令

Add-Migration RecordingTagEdits -Verbose

我希望在迁移脚手架中进行架构更新以添加新表.相反,我收到错误"'System.Net.ServicePointManager'的类型初始化程序引发异常."

我做错了什么,我该如何解决?

完整的错误跟踪是:

System.TypeInitializationException:'System.Net.ServicePointManager'的类型初始值设定项引发了异常.---> System.TypeInitializationException:'System.Net.ComNetOS'的类型初始值设定项引发了异常.---> System.Configuration.ConfigurationErrorsException:元素只能在本节中出现一次.System.Configuration.BaseConfigurationRecord.EvaluateOne(String []键,SectionInput输入,Boolean isTrusted,FactoryRecord factoryRecord,SectionRecord sectionRecord,Object parentResult)at(C:\ TFS\HXDMSRC\VisualCollections\Development\VCollectAPI\tmp140.tmp第16行)at at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord,SectionRecord sectionRecord,Object parentResult,Boolean getLkg,Boolean getRuntimeObject,Object&result,

小智 10

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