SQLServer deployment issues

Mar 18, 2010 at 2:53 PM
Edited Mar 18, 2010 at 6:37 PM

I am having trouble getting Slickticket to run against a SQL server that is not ".\SQLEXPRESS'  *edit i had now instead of not*

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. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"

Source Error:

Line 25:         UserName = GetUsername();

Line 26:         el.WriteEntry(db.Connection.ConnectionString, EventLogEntryType.Error);

Line 27:         Details = db.users.FirstOrDefault(u => u.userName.Equals(UserName));

Line 28:         HighestAccessLevelGroup = GetHighestAccessLevelGroup(db);

Line 29:         IsRegistered = Details != null;


Source File: c:\SlickTicket_Test\App_Code\CurrentUser.cs    Line: 27 Source Error:

 As you can see I added wrote an event log out with the connection string and it shows up as follows:  "Data Source=.\SQLEXPRESS;Inital Catalog=SlickTicket;Integrated Security=True"

 This is not the connection string in my web.config

<connectionStrings>
  <add connectionString="
            Data Source=****\MSSQLSERVER;         
            Initial Catalog=SlickTicket;
            User ID=****;
              Password=****;"
            providerName="System.Data.SqlClient"/>
 </connectionStrings>

 

I even went into the DBML file and change the connection string in there, to no avail. Any idea what’s going on an how I can fix this?

 

Mar 18, 2010 at 3:19 PM

I hope someone can give advise on how are these problems are showing up with SQL Express. I have connected countless of apps to databases but this caught me clueless.

Mar 18, 2010 at 6:38 PM

Sorry Jay.  I had a typo in that post.  I am trying to use a Standard install of SQLSever instead of SQLExpress.  But it's getting a SQLExpress connection string from somewhere that I can't find.

Coordinator
Mar 19, 2010 at 2:01 AM

You are correct that this is a connection problem - try out your connectionstring in Visual Studio or SMS first.

Mar 19, 2010 at 5:22 PM

The connection string I am placing in the web configuration is good(it works in VS and SMS).  That is not the connection string that is being used by the:  c:\SlickTicket_Test\App_Code\CurrentUser.cs file.

Mar 25, 2010 at 7:09 PM
Edited Mar 25, 2010 at 7:10 PM

I think I'v tracked down where my point of failure is.

In the CurrentUser.cs file, when you load Slickticket it executres the Constructor. 

 private CurrentUser()
    {
        stDataContext db = new stDataContext();
        UserName = GetUsername();
         Details = db.users.FirstOrDefault(u => u.userName.Equals(UserName));
        HighestAccessLevelGroup = GetHighestAccessLevelGroup(db);
        IsRegistered = Details != null;
        IsAdmin = (Details != null && Details.is_admin);
    }

The DataContext being created it using the 'default' settings and not reading connection strings from the configuration file.  The only way I know how to change that connection string is to modified the Settings.settings file in the DomainModel and to then rebuild the application.  Is there someway to change this setting without rebuilding the domain model?

Coordinator
Mar 30, 2010 at 6:01 AM

The only way I know how to do this is to rebuild the DomainModel, which it looks like you know how to do already.

Why don't you want to rebuild the DM?

The reason I did it like this is to keep it simple for most users, as most would not need it to be changed, sorry if it caused you any inconvenience.