2009-09-16 23 views
2

我收到此错误信息时,我曾经尝试更新或保存我的实体数据模型注册的生成提供:实体框架:无法Web.Config中

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破碎。

回答

1

你应该将下面的行

<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"> 

改变

<configuration> 

在你的web.config文件。

0

不知道是什么导致了这种情况,可能是实体框架文件已经以某种方式损坏了。

修复它的简单方法是删除模型,从web.config中删除任何引用,然后使用向导再次创建模型。

0

我最终做的是通过回滚我的代码。 SVN。我没有花时间弄清楚什么是错误的。如果再次发生,我会发布更多信息。

-1

它一定会奏效。

<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"> 

<configuration> 

失败原因是:因为这个设置,建立供应商无法在web.config中注册的连接字符串。