0

I have a simple Windows Forms project, which is linked to another project, a class library called "Model". This Model project uses LINQ-to-SQL to connect to a MDF database. When I test it locally, it works just fine, but when I try it on another machine, even though I have the .NET framework installed, it cannot connect, I get a timeout and an error: "Error occurred while establishing a connection to SQL Server"

Error message

The connection string I'm using to connect is Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\db.mdf;Integrated Security=True;Connect Timeout=30" providerName="System.Data.SqlClient

I made a dummy repo to share the code, it can be found here: https://github.com/gosukiwi/TestConnect.

Maybe I should use an SQL server or an Access database instead? Cheers.

gosukiwi
  • 1,569
  • 1
  • 27
  • 44

1 Answers1

0

I think you'll find these helpful:

http://blogs.msdn.com/b/sqlexpress/archive/2011/12/09/using-localdb-with-full-iis-part-1-user-profile.aspx

http://blogs.msdn.com/b/sqlexpress/archive/2011/12/09/using-localdb-with-full-iis-part-2-instance-ownership.aspx

I tend to use LocalDB when developing but then shift to our live servers SQL Server instance on production deployment.

What you're trying to do is possible, but requires loading the user profile. I've also seen some suggestions on changing the identityType of the application for a quick fix: How to deploy ASP.NET MVC 4 application using localDB to local IIS on Windows 7? but i'd suggest doing a good read up.

Community
  • 1
  • 1
CannonFodder
  • 332
  • 2
  • 11