locked
connection string woes RRS feed

  • Question

  • hi,

    Pardon my ignorance but I'm always just used to developing and running on Cassini and never had to bother about setup until now.

    Everytime I add an sql server database in visual studio 2010 it creates a database under App_Data and then the connection string the server explorer uses is one which has an AttachDb field that points to the file. Which works all good on Cassini. Now when I tried that on 2 IIS servers 6 and 7.5 I had a slew of errors saying the user :

    "An attempt to attach an auto-named database for file XX failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share."

    If I use this format "Server=\sqlexpress;Database=xxx;Trusted_Connection=True" I get -> "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections."

    I spent a whole day trying all kinds of different connection strings, configurations, and combinations!! =S What is the RIGHT way this is to be done? Should I create the database in sql management studio 2008 R2 express? What KIND OF connection string do I need, and what config do I need on SQL SERVER 2008 R2 Express running on IIS 6.0 and Windows Server 2003 R2?(That the machine I need it to run on)

    Thanks


    -Gideon MCTS:Windows Development and C# geek.
    Thursday, June 24, 2010 3:41 AM

Answers

  • Don't you need Server=<computername>\sqlexpress  ?
    Rick Byham, Microsoft, SQL Server Books Online, Implies no warranty
    Thursday, June 24, 2010 3:44 PM
    Answerer

All replies

  • Please make sure that SQL Browser service is running? Windows firewall?

    <cite>www.connectionstrings.com</cite>


    Best Regards, Uri Dimant http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/
    Thursday, June 24, 2010 5:49 AM
    Answerer
  • Don't you need Server=<computername>\sqlexpress  ?
    Rick Byham, Microsoft, SQL Server Books Online, Implies no warranty
    Thursday, June 24, 2010 3:44 PM
    Answerer
  • hey, so apparently ... on IIS 7.5 the APP pool login security is the problem. But on my dev box all that was the problem was using localhost\sqlexpress instead .\sqlexpress! =) Running all smoothly now!!
    -Gideon MCTS:Windows Development and C# geek.
    Friday, June 25, 2010 5:15 PM