多次指定常量名System.Data.SqlClient的提供者我把实体框架更新到6.0了,现在搞定了一个我无法弄清楚的例外。为entityFramework创建配置部分处理程序时出错:在应用程序配置中多次指定了具有不变名称“System.Data.SqlClient”的提供程序。每个配置的提供者的不变名称必须是唯一的。(C:\inetpub\wwwroot\scrape\Scrape\web.config第106行)“System.Data.Entity.Internal.AppConfig”的类型初始值设定项引发异常。web.config没有多次列出提供者,整个项目我只有一个web.config。我感谢任何帮助。堆垛跟踪在System.Data.Entity.Internal.AppConfig.get_DefaultInstance()在System.Data.Entity.Internal.LazyInternalConnection..ctor(StringnameOrConnectionString)在System.Data.Entity.DbContext..ctor(StringnameOrConnectionString)在Scrape.Data.Contexts.ScabsContext..ctor()在c:inetpubwwwrootscrapeScrape.DataContextsScabsContext.cs:第17行在Scrape.Data.Repositories.ScabStore..ctor()在c:inetpubwwwrootscrapeScrape.DataRepositoriesScabStore.cs:第15行位于Scrape.Api.Controllers.ScabsController.get_store()在c:inetpubwwwrootscrapeScrapeControllersScabsController.cs:第28行位于Scrape.Api.Controllers.ScabsController.Post(Scabscab)c:inetpubwwwrootscrapeScrapeControllersScabsController.cs:第52行在lambda_method(Closure,Object,Object[])在System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor。c_DisplayClassc.b_6(Objectinstance,Object[]methodParameters)atSystem.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Objectinstance,Object[]arguments)atSystem.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContextcontrollerContext,IDictionary`2arguments,CancellationTokencancellationToken)也是我的web.config问题是configuration/entityFramework/providers部分对于异常中指定的不变量有重复的提供者。即使您只指定了一个,也可能会在父目录的.config文件中指定一个。由于.config文件从父级继承配置,它会看到它被定义了两次。您可以安全地删除此应用程序的此提供程序。基于CodePlex项目,这已在6.1.0-alpha1中“修复”,忽略完全重复的内容。尝试注释掉提供程序部分,保存并重新运行。可能与此有关“System.Data.Entity.Internal.AppConfig”的类型初始值设定项在子站点上抛出异常我收到此错误是因为此处未包含“EntityFramework.SqlServer.dll”文件项目发布。将此DLL添加到Web服务器bin文件夹可解决此问题。为了解决这个问题,我把父文件夹下的web.configentityFramework部分包装成:...见https://stackoverflow.com/a/6199749/2718874以上是C#学习教程:指定常量名System。数据多次。如果SqlClient提供者分享的所有内容对您有用,需要进一步了解C#学习教程,希望您多多关注。本文收集自网络,不代表立场。如涉及侵权,请点击右侧联系管理员删除。如需转载请注明出处:
