1

I tried to find information about this on the web and Stack Overflow, but none of the responses could help me solving my problem.

I'm working with C# and SQL Server. I'm using code from an existing project, which project connects to an SQL Server instance to manage data. This project uses EntityFramework.

Now I want to use a local instance of SQL Server, precisely SQL Server Express, for development purpose. But I can't figure out how to connect to this local instance.

Connecting to the remote SQL Server works perfectly, using this connection string:

<add name="ProjectEntities" connectionString="metadata=res://*/Project.Project.csdl|res://*/Project.Project.ssdl|res://*/Project.Project.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=111.111.111.666\(local), 1433;initial catalog=PROJECT;persist security info=True;user id=user;password=password;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

But if I modify it to use my local instance:

<add name="ProjectEntities" connectionString="metadata=res://*/Project.Project.csdl|res://*/Project.Project.ssdl|res://*/Project.Project.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.\PROJECT, 1433;initial catalog=PROJECT;persist security info=True;user id=user;password=password;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

it doesn't work.

I tried with putting the source in "MAC\PROJECT" also, it does not change anything. Using the udl file workaround to test connection parameters is totally OK both with "MAC\PROJECT" and ".\PROJECT" and the right credentials.

I can't figure out why my project connect to the database perfectly using the remote server but not the local one. Am I missing something?

1

1 Answer 1

1

Right after posting this question I found the answer.... The old connection string gives a port number, which is not needed when connecting to the local instance.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.