[英]How can i resolve this error the 'connectionStringName' attribute is not allowed in web.config of asp.net in MVC 4
How can i resolve the issue of connectionStringName' attribute is not allowed in visual studio in mvc 4 asp.net我如何解决 mvc 4 asp.net 中的 Visual Studio 中不允许 connectionStringName' 属性的问题
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
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>
Remove:移除:
<add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=aspnet-MVE-20171019175539;Integrated Security=SSPI" />
from your connection strings.从您的连接字符串。 You don't need it since you're using 'SchoolContext'.
您不需要它,因为您使用的是“SchoolContext”。
Remove as well:也删除:
<providers>
<add name="DefaultSessionProvider"
type="System.Web.Providers.DefaultSessionStateProvider,
System.Web.Providers, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
</providers>
You're not using any sort of authentication are you?您没有使用任何类型的身份验证,是吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.