简体   繁体   中英

How to fix this Keyword not supported “provider” for C#?

First, I had similar problem Keyword not supported for "metadata". So, I wrote data source instead of metadata. After that, I tried to create Controller for ASP.NET MVC and that show me Keyword not supported for "provider". I read the some case for SQL SERVER connection, but I didn't found for Oracle connection. Here is my connectionStrings in web.config file.

   <connectionStrings>
        <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-MVC-20170801212521;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-MVC-20170801212521.mdf" providerName="System.Data.SqlClient" />
        <add name="EntitiesLL" connectionString="Data Source=res://*/Models.Model1.csdl|res://*/Models.Model1.ssdl|res://*/Models.Model1.msl;provider=Oracle.ManagedDataAccess.Client;data source=****:1111/xe;password=******;user id=******;" providerName="System.Data.SqlClient" />   
   </connectionStrings>

Thank you.

The problem is this

providerName="System.Data.SqlClient"

Something tells me it should be OracleClient .

According to official documentation this should read:

<connectionStrings>
        <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-MVC-20170801212521;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-MVC-20170801212521.mdf" providerName="System.Data.SqlClient" />
        <add name="EntitiesLL" connectionString="Data Source=res://*/Models.Model1.csdl|res://*/Models.Model1.ssdl|res://*/Models.Model1.msl;data source=****:1111/xe;password=******;user id=******;" providerName="Oracle.ManagedDataAccess.Client" />   
</connectionStrings>

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