2009-09-16 59 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中註冊的連接字符串。