views:

849

answers:

1

I'm using an AspNetSqlMembershipProvider for my application.

On my development machine I recently deinstalled SQL Server 2005 Express and Management Studio Express so that I could install the full version of Management Studio. I chose not to install SQL Server 2005 because, well, I don't want to have unnecessary things running on my machine.

Now whenever my code attempts to do anything that relates to authentication I get an error of:

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)

So, what is the minimum amount of SQL Server I have to install in order for this to work?

+1  A: 

You could get away without having any SQL Server instances installed, especially if all you're using it for is Membership, Roles and the default Profiles.

The default connection string often looks like this:

<connectionStrings>
  <add name="LocalSqlServer" 
       connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
       providerName="System.Data.SqlClient"/>
</connectionStrings>

If you change your SQL connection string, to match the value of "connectionString" above, that will force ASP.NET to generate the standard ASP.NET database for you withing the "App_Data" folder of your site - the keep part is "AttachDBFilename" which tells it to open the mdf file directly rather than attach to a SQL instance.

However, you might have some difficulty connecting to that file with SQL Management Studio.

You'll probably have to change the connection string once you move the site off development and into production, to point to a full instance of SQL if you so wish, rather than stick with the file based version.

Alternatively, what I tend do is have SQL Server installed (Express or otherwise), but the services stopped unless I'm actually using them. Then I just start them up when I'm developing.

Also you can have the Express version of SQL Server installed on the same machine as theh the full version SQL Management Studio without any problems.

Zhaph - Ben Duguid