简体   繁体   中英

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

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>

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'.

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM