Click here to Skip to main content
15,889,034 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created database-first from entity framework,the framework created connection string in my web.config like
<connectionStrings>
    <add name="projeEntities" connectionString="metadata=res://*/Models.EntityFrameworks.ProjeModel.csdl|res://*/Models.EntityFrameworks.ProjeModel.ssdl|res://*/Models.EntityFrameworks.ProjeModel.msl;provider=Npgsql;provider connection string="Host=127.0.0.1;Database=proje;Username=postgres;Password=sdt2018; Persist Security Info=True"" providerName="System.Data.EntityClient" />
  </connectionStrings>

but this is not working ,visual studio gave this error
System.Data.Entity.Core.EntityException: 'The underlying provider failed on ConnectionString.'

When I change web.config like
<add name="projeEntities"
           connectionString="Server=127.0.0.1;Database=proje;User Id=postgres;Password=sdt2018;"
           providerName="Npgsql" />

visual studio gave code first error but I am working on database first. Can you help me?

What I have tried:

I have tried to change connection string but it didnot help me
Posted
Updated 14-Aug-18 22:15pm

<add name="DefaultConnection" connectionString="Data Source=servername;Initial Catalog=databasename;Persist Security Info=True;User ID=sa;Password=yourpassword" providerName="System.Data.SqlClient"/>

<add name="AEntities" connectionString="metadata=res://*/EntityModel.AModel.csdl|res://*/EntityModel.AModel.ssdl|res://*/EntityModel.AModel.msl;provider=System.Data.SqlClient;provider connection string="data source=servername;initial catalog=databasename;persist security info=True;user id=sa;password=yourpassword;multipleactiveresultsets=True;application name=EntityFramework"" providerName="System.Data.EntityClient" /></connectionStrings>
 
Share this answer
 
<connectionStrings>
  <add name="projeEntities" connectionString="metadata=res://*/Models.EntityFrameworks.ProjeModel.csdl|res://*/Models.EntityFrameworks.ProjeModel.ssdl|res://*/Models.EntityFrameworks.ProjeModel.msl;provider=Npgsql;provider connection string="Host=127.0.0.1;Database=proje;Username=postgres;Password=sdt2018;"" providerName="System.Data.EntityClient" />
</connectionStrings>
I did this and version check,then it works
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900