Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

entity framework - The connection string 'MyConnection' in the application's configuration file does not contain the required providerName attribute."

I use Entity Framework Code First,

My connection string is in a configuration file:

<connectionStrings>
    <clear/>
    <add name="ApplicationServices" connectionString="Data Source=PC-X;Initial Catalog=MYdb;Integrated Security=True"/>
  </connectionStrings>

When I try to access the data (something that should create the DB) is falling with the following error:

The connection string 'ApplicationServices' in the application's configuration file does not contain the required providerName attribute."

What am I missing?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You're missing the following piece of code after the connectionString attribute (assuming that you're using SQL):

providerName="System.Data.SqlClient"


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...