NioDeTark
NioDeTark

Reputation: 41

code first -The provider did not return a ProviderManifestToken string

I wrote a windows form solution with 2 layers; one is DataAccess and the other is windows form. I use Code first. If DataAccess Layer runs in the application console, there is no problem with the db. Create the schema and insert the data.

However, when I run the solution with Windows Form as the initial project and refer to DataAccess as a dll, I cannot build the database. It throws an exception.

I think that the app.config file is the problem, but if I copy the app.config file of DataAccess project to the windows form, it does not resolve the problem.

the config file of DataAcces layer:

  <?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
  </startup>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
</configuration>

the exception:

"first exception for 'System.Data.Entity.Core.ProviderIncompatibleException' in     EntityFramework.dll

Aditional Information: An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct."

Inner Exception:

{"The provider did not return a ProviderManifestToken string."}

Upvotes: 1

Views: 3793

Answers (2)

Robin Rana
Robin Rana

Reputation: 13

The problem could be due to Error in connection string or in my case it was that SQL server service was not running manually start the SQL service through SQL SERVER COnfiguration Manager

Upvotes: 1

NioDeTark
NioDeTark

Reputation: 41

after a long deep search, i found that solution was "clean the solution".

Upvotes: 0

Related Questions