❔ The ConnectionString property has not been initialized error coming on accessing the sql server
Hi! I am trying to access mysql server from MVC Core application with EF Core .I am running sql server in my local docker container .Also I am on visual studio Mac. When I try to access the server I am getting the ConnectionString property has not been initialized error . The connection string works fine when I connect to azure data studio . The following are the screenshots for the appsettings.json and program.cs respectively . Please let me know if you want to know anymore details.
9 Replies
what code do you use to pass the connection string to the DbContext?
Is it not supposed to be "localhost:1433" instead of "localhost,1433"
@phaseshift I am using builder services in program.cs to configure the dbcontext connection .The following is the screenshot for the same
@E-kenny I think localhost :1433 and localhost,1433 are similiar I have seen localhost,1433 also working fine. Did give localhost:1433 a try but it did not work .
In your program.cs line 10, correct the spelling of "ConnectionStrings"
Thanks a lot kenny , can't believe I didn't see the incorrect spelling
Thanks a lot HenkyPenky
So now I am getting error A network-related or instance-specific error occurred while establishing a connection to SQL Server. It seems to be due to docker image of sql .Do I need to make changes to docker ?
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.