2014-04-04 18 views
0

未處理我與亞當弗里曼親asp.net mvc 5書的麻煩。當我嘗試開始調試時,發現錯誤: System.Data.dll中發生類型'System.ArgumentException'的異常,但未在用戶代碼中處理其他信息:不支持關鍵字:'initialcatalog'.But Web .config不在書中。 屏幕:[1]:http://imgur.com/3TpOL0Eargumentexception由用戶代碼asp.net mvc

我的web.config代碼:

<?xml version="1.0" encoding="utf-8"?> 
<!-- 
    For more information on how to configure your ASP.NET application, please visit 
    http://go.microsoft.com/fwlink/?LinkId=301880 
    --> 
<configuration> 
    <configSections> 
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> 
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> 
    </configSections> 
    <connectionStrings> 
    <add name="EFDbContext" connectionString="Data Source=(localdb)\v11.0; InitialCatalog=SportsStore; Integrated Security=True" providerName="System.Data.SqlClient" /> 
    </connectionStrings> 
    <appSettings> 
    <add key="webpages:Version" value="3.0.0.0" /> 
    <add key="webpages:Enabled" value="false" /> 
    <add key="ClientValidationEnabled" value="true" /> 
    <add key="UnobtrusiveJavaScriptEnabled" value="true" /> 
    </appSettings> 
    <system.web> 
    <compilation debug="true" targetFramework="4.5" /> 
    <httpRuntime targetFramework="4.5" /> 
    </system.web> 
    <entityFramework> 
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> 
     <parameters> 
     <parameter value="v11.0" /> 
     </parameters> 
    </defaultConnectionFactory> 
    <providers> 
     <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> 
    </providers> 
    </entityFramework> 
</configuration> 

P.S.對不起我的谷歌翻譯英文。

回答

0

嘗試連接字符串中添加一個空格,像這樣:

Initial Catalog=SportsStore; 
+0

它並沒有幫助。 –

+0

你可以顯示書中的連接字符串嗎? – markpsmith

+0

有:http://imgur.com/U7I86eg –