Sunday, February 19, 2012

Enable Production SQL Server Express for SQLCacheDependency?

Q1: Can I just open these protocols I need (see web links below) and then close them down again after SQLCacheDependency has been enabled? Note: The website (asp.net 2.0/SQL server Express) operates OK right now with asp.net - but it does not have SQLCacheDependency enabled.

Problem: When I try to do this I keep on getting this error message:

"An error has occurred when establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections."

None of these 3 commands have worked (all give the same message above):

aspnet_regsql.exe -U user1 -P pwd1 -S server1/SQLEXPRESS -d myDBName -ed
aspnet_regsql.exe -E -S server1/SQLEXPRESS -d myDBName -ed
aspnet_regsql.exe -E -S .\SqlExpress -d myDBName -ed

I am trying to run these commands via a MSTSC connection. Q2: Is that (terminal server) the problem (the "remote connection") complained of above ?

This is the command that worked on my local dev machine:

aspnet_regsql.exe -E -S .\SqlExpress -d myDBName -ed

Q3: Must I really go through the procedure "How to: Configure Express to accept remote connections" at:

http://support.microsoft.com/default.aspx?scid=kb;EN-US;914277
http://blogs.msdn.com/sqlexpress/archive/2005/05/05/415084.aspx

I don't really want to have SQL server accepting any connections as the last time it was listening on these ports we had so many attacks being made that it was filling up the logs!

What I can't understand is that every night the database is backed up with the following command line code (operating as a Scheduled Task):

sqlcmd -s server1/SQLEXPRESS -i MW4BAK.SQL -E

Q4: So if the server is happy receiving commands from 'sqlcmd.exe' why does it have such problems with 'aspnet_regsql.exe'

Q5: If I grouped those statements I need to setup SQLCacheDependency under a Scheduled Task would they work (as there would presumably be no remote connection then) or is it something in the nature of the connection established which allows sqlcmd.exe to work but stops aspnet_regsql.exe?

I was able to configure the database for cache dependency by just running the command with no parameters and letting the wizard take over:

aspnet_regsql.exe

But ICAN NOT enable the tables e.g.
aspnet_regsql.exe -E -S server1\SqlExpress -d myDBName -t myTable1 -et
continues to give the error message above (implying that it won't allow a remote connection).

What's the problem? Is it because I'm running the command remotely under terminal server?

|||

Apologies. I sorted it out.

The SQL instance is not called "server1/SQLEXPRESS". It is only
"server1" (on this server). So the following will work.

aspnet_regsql.exe -E -S server1 -d myDBName -ed
aspnet_regsql.exe -E -S server1 -d myDBName -t myTableName -et

etc. for each table

No comments:

Post a Comment