我如何解决此错误 MVC 4 中 asp.net 的 web.config 中不允许 'connectionStringName' 属性
How can i resolve this error the 'connectionStringName' attribute is not allowed in web.config of asp.net in MVC 4
如何解决 connectionStringName' attribute is not allowed in visual studio in mvc 4 asp.net
的问题
web.config
<connectionStrings>
<add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=aspnet-MVE-20171019175539;Integrated Security=SSPI" />
<add name="SchoolContext" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\university.mdf;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
Web.config
// Line 60 column 189 the code below
<providers>
<add name="DefaultSessionProvider"
type="System.Web.Providers.DefaultSessionStateProvider,
System.Web.Providers, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
</providers>
删除:
<add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=aspnet-MVE-20171019175539;Integrated Security=SSPI" />
来自您的连接字符串。你不需要它,因为你正在使用 'SchoolContext'.
同时删除:
<providers>
<add name="DefaultSessionProvider"
type="System.Web.Providers.DefaultSessionStateProvider,
System.Web.Providers, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
</providers>
您没有使用任何类型的身份验证是吗?
如何解决 connectionStringName' attribute is not allowed in visual studio in mvc 4 asp.net
的问题web.config
<connectionStrings>
<add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=aspnet-MVE-20171019175539;Integrated Security=SSPI" />
<add name="SchoolContext" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\university.mdf;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
Web.config
// Line 60 column 189 the code below
<providers>
<add name="DefaultSessionProvider"
type="System.Web.Providers.DefaultSessionStateProvider,
System.Web.Providers, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
</providers>
删除:
<add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=aspnet-MVE-20171019175539;Integrated Security=SSPI" />
来自您的连接字符串。你不需要它,因为你正在使用 'SchoolContext'.
同时删除:
<providers>
<add name="DefaultSessionProvider"
type="System.Web.Providers.DefaultSessionStateProvider,
System.Web.Providers, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
</providers>
您没有使用任何类型的身份验证是吗?