我尝试更新或保存实体数据模型时收到此错误消息:
ERROR: Unable to register the build provider in Web.Config because of the following exception: 'Object reference not set to an instance of an object.'.
然后,当我尝试运行应用程序时,我得到:
The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.
如何修复它以便能够写入Web.config。我用精细的牙齿梳理过它,但我没有想到任何XML破坏的东西。
答案 0 :(得分:1)
您应该更改以下行
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
到
<configuration>
在你的web.config文件中。
答案 1 :(得分:0)
不确定导致这种情况的原因可能是实体框架文件在某种程度上已经损坏。
修复它的简单方法是删除模型,从web.config中删除任何引用,然后使用向导再次创建模型。
答案 2 :(得分:0)
我最终做的是通过回滚我的代码。 SVN。我没有花时间弄清楚到底出了什么问题。如果再次发生,我会发布更多信息。
答案 3 :(得分:-1)
一定会有效。
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
到
<configuration>
失败的原因是:由于此设置,构建提供程序无法在web.config中注册连接字符串。