简体   繁体   English

我如何解决此错误,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

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.

相关问题 Web.config文件ASP.NET MVC中出现双重错误 - Double error in Web.config file ASP.NET MVC Asp.net MVC web.config中的客户错误 - Customer Error in Asp.net MVC web.config ASP.NET 5 MVC 6中的web.config - web.config in ASP.NET 5 MVC 6 达到文件限制时如何返回错误? 上传 + asp.net mvc 3 + web.config - How to get an error back when file limit is reached? Plupload + asp.net mvc 3 + web.config 错误 - 不允许使用 connectionStringName 属性 - Error - connectionStringName attribute is not allowed Web.config中的“属性&#39;connectionStringName&#39;丢失或为空。” - “The attribute 'connectionStringName' is missing or empty.” in Web.config 如何在ASP.NET 4.5中访问web.config配置文件属性? - How can I access web.config Profile properties in ASP.NET 4.5? 如何在TFS2017 for ASP.NET应用程序上进行web.config转换 - How can I make a web.config tranformation on the TFS2017 for ASP.NET application 如何在web.config之外的ASP.Net中保留连接字符串? - How can I persist a connection string in ASP.Net outside of web.config? 如何在asp.net中的web.config位置路径中添加和删除授权用户 - How can I add and remove authorised users from web.config location path in asp.net
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM