Connection problem in Visual Studio 2008 C# with SQL Server 2008 Express
- From: "ronconger09@xxxxxxxxx" <ronconger09@xxxxxxxxx>
- Date: Sat, 21 Mar 2009 17:41:14 -0700 (PDT)
Here is my problem. I did manage to install VS08 (Express) with SQL
Server 2008 Express, as I indicate in this post here:
http://groups.google.com/group/microsoft.public.sqlserver.setup/browse_thread/thread/51f28e4c04fb542e/819103b0e353c836?hl=en#819103b0e353c836
But the problem is, when using the Visual Studio 2008 Visual C# wizard
to make a new connection for a new programming project (so we're
starting from a blank slate), as I have done successfully hundreds of
times when I was using Visual Studio 2008 (a non-express version, but
that should not matter) and SQL Server 2005, I found that for this
setup (as defined in the header of this post) only SQL Server Compact
Edition is supported. That is, I can connect to a "Compact" dB but
not to a regular dB like "AdventureWorks" or "NorthWind".
After surfing the web for an hour, my head spins. I have all kinds of
ideas. I did go under Visual Studio and set the Options for Database
"SQL Server Instance Name (blank for default)" to various things, such
as: {blank}, .\SQLExpress, .\SQLEXPRESS, SQLEXPRESS, CORE2-PC
\SQLEXPRESS (this last one being the name of my machine). Did not
work for regular SQL dBs (again, no problem with the "Compact" edition
dB's, since apparently the dB engine is built into Visual Studio 2008
Express).
///////////////////////////////////////////////////////
Next, I was inspired by a post here:
http://www.eggheadcafe.com/conversation.aspx?messageid=33228600&threadid=33228594
I decided perhaps the problem is permissions, specifically, note what
this Microsoft employee says "It is most likely a logon failure since
you could connect to the same instance with the same conneciton string
in a WinForm application. Did you specify "Integrated Security=SSPI"
or application and a WinForm application. The reason is that if you
host your WCF service in IIS 6.0, the service is actually running
under the account of the application pool's identity while a WinForm
application is running with the user who starts it, normally the
current Windows Logon account. I recommend that you check the current
Identity of your application pool which hosts your WCF service:
1. Open IIS, expand Web Sites, and then expand Default Web Site, right
click the virtual directory for your WCF service, click Properties and
you can find the Application Pool in which it is
running .
2. In IIS, expand Application Pools folder, right click the
Application Pool in which your WCF service is running, click
Properties, switch to the Identity tab, and check what the account
is.
If it is a NETWORK SERVICE account, I think that you can resolve this
issue by one of the following three methods:
1. Change the NETWORK SERVICE account to a domain user account that is
a valid login in your SQL Server instance or to the same account as
your current Windows logon account;
2. In your remote SQL Server instance, manually add the computer
account of your server which runs your WCF service. Assume that its
name is MYCOMPUTER and in the domain MYDOMAIN,
and you can add the following computer name as a login to your SQL
Server instance: MYDOMAIN\MYCOMPUTER$, and then assign it required
permissions on your database.
3. You may consider using a SQL login to connect to your SQL Server
instance. For example, you can add "uid=sa;pwd=xxxxx" to your
connection string.
///////////////////////////////////////////////////////
However, I'm not sure this applies to me (I use default Windows
Authentication), and I don't have a tool for IIS like the above,
except for the MS SQL Server Management Studio tool that came with SQL
Server 2008 --Advanced version with tools.
But here's another clue, from the log files of my SQL Server 08:
2009-03-21 18:32:50.41 Server Server local connection provider is
ready to accept connection on [ \\.\pipe\SQLLocal\SQLEXPRESS ].
2009-03-21 18:32:50.41 Server Server local connection provider is
ready to accept connection on [ \\.\pipe\MSSQL$SQLEXPRESS\sql\query ].
2009-03-21 18:32:50.43 Server Dedicated administrator connection
support was not started because it is disabled on this edition of SQL
Server. If you want to use a dedicated administrator connection,
restart SQL Server using the trace flag 7806. This is an informational
message only. No user action is required.
Look at the last entry. Is this trying to tell me that the program
Visual Studio 2008 C#, which is running under Core2-PC\rconger {my
Admin account, not User, but Admin} should in fact be running under
one of these two accounts, namely: NT AUTHORITY\SYSTEMS or NT SERVICE
\MSSQL$SQLEXPRESS ? It is apparently not saying that the Express
version of Visual Studio 2008 does not work with regular databases--I
checked this at Microsoft, and it does.
If this is so, how do I do this using what tool? Or can I somehow (as
hinted by the Microsoft employee answer to the other guy) map these
onto my Admin account (that I use to program in C# with), namely,
"Core2-PC\rconger "?
So confusing. Again, right now I'm stuck with "Compact" databases
which are accessed by Visual C# Studio 2008 express by the "built in"
engine "Microsoft SQL Server Compact 3.5" as opposed to the "Microsoft
SQL Server Database file" under the Wizards (which, again, under
previous versions of SQL Server 2005 I was able to connect to various
regular databases with).
Note I am not trying to access any database using an old connection
string (as is often the case with thse kind of connection questions
posted on the web) but a new connection, so this makes the problem a
bit easier to define.
Any help appreciated.
RC
PS--
I will follow up with the error messages given by Visual Studio 2008
Express (for Visual C#) when the connection fails. These messages I
think are pretty generic, but they might give a clue.
RC
---------------------------
Microsoft Visual C# 2008 Express Edition
---------------------------
Failed to generate a user instance of SQL Server due to a failure in
starting the process for the user instance. The connection will be
closed.
---------------------------
OK
---------------------------
///////////////////////////////////////////////////////////////////////
---------------------------
Microsoft Visual C# 2008 Express Edition
---------------------------
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: Named
Pipes Provider, error: 40 - Could not open a connection to SQL
Server)
---------------------------
OK
.
- Follow-Ups:
- Prev by Date: Re: sql 2008 install problem re: visual studio 2008
- Next by Date: Re: Connection problem in Visual Studio 2008 C# with SQL Server 2008 Express
- Previous by thread: Re: sql 2008 install problem re: visual studio 2008
- Next by thread: Re: Connection problem in Visual Studio 2008 C# with SQL Server 2008 Express
- Index(es):
Relevant Pages
|