NerdDinner 1.0 with Microsoft SQL Server 2008

Apr 2, 2009 at 2:27 PM
Edited Apr 2, 2009 at 2:34 PM

I don't have any kind of experience with ASP.NET and Visual Studio 2008 and I'm trying to learn ASP.NET MVC using Application.
My big problem now is SQL Express because i don't have it, I'm using Visual Studio 2008 SP1 + .NET 3.5 with Microsoft SQL Server 2008 on Windows 2008 Server Enterprise and I don't know from where to start to make Application to work with SQL Server 2008.

Somebody can give me some hints or guide me to make this application working on my environment?

Apr 2, 2009 at 4:29 PM
Sure, the only difference will be that the connection string will not include \SQLEXPRESS at the end. Rather than creating the MDF file in the App_Data folder, you'll use the Server Explorer (or your SQL Studio or whatever your favorite DB utility is) to create the database and tables. Everything else will work as before. When it comes time to do the authorization/authentication stuff, you'll run aspnet_regsql from the command line to make the authorization database.
Apr 3, 2009 at 9:49 AM
Hi shanselman,

I have the DB and Tabels but i don't get how to make the connection to the DB (db_owner is NT AUTHORITY\NETWORK SERVICE).

In NerdDinner.dbml I made this changes on line 3

  <!--<Connection Mode="WebSettings" ConnectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\NerdDinner.mdf;Integrated Security=True;User Instance=True" SettingsObjectName="System.Configuration.ConfigurationManager.ConnectionStrings" SettingsPropertyName="NerdDinnerConnectionString" Provider="System.Data.SqlClient" />-->
  <Connection Mode="WebSettings" ConnectionString="Data Source=localhost;Initial Catalog=NerdDinner;Integrated Security=True" SettingsObjectName="System.Configuration.ConfigurationManager.ConnectionStrings" SettingsPropertyName="NerdDinnerConnectionString" Provider="System.Data.SqlClient" />

But I think is something wrong with my approach because I get this error::

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)
Apr 3, 2009 at 4:47 PM
(I'm assuming your running Visual Studio on the same machine that the SQL Server is on...)

When you installed SQL Server 2008, it should have also installed a tool called SQL Server Management Studio.  Find that tool and open it up and try to connect to your server; you should be able to just open the Management Studio and click connect.  There should be no errors when you do that.

If there are errors, more than likely you're going to need to do some configuration / installation / re-installation.  Try and give us as much information as possible.

Hope that helps.
Apr 3, 2009 at 11:56 PM
radu - You can also try making a Connection yourself from the Server Explorer, and once you get that to succeed, right click on it, hit "Modify Connection" and you'll see in the dialog. You can then copy that connectionstring to the web.config.
Apr 4, 2009 at 1:22 AM
Edited Apr 4, 2009 at 5:06 AM
I believe the settings in ConnectionStrings.config are what you'll need to modify to point it at a standalone database instead of the user instance. That's how I did it for my local setup (user instances weren't working for me) and it worked perfectly.

You will still need to run aspnet_regsql to set up the membership database too, as Scott mentioned.
Apr 6, 2009 at 8:58 AM

thanks to all for help, I managed to make SQL 2008 connection.

On ConnectionStrings.config file you have to change Data Source

  <!-- Orriginal Connection for SQLEXPRESS
  <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
  <add name="NerdDinnerConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\NerdDinner.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
  <!-- My Connection for SQL Server -->

  <add name="ApplicationServices" connectionString="Data Source=localhost;Initial Catalog=NerdDinner;Integrated Security=True" providerName="System.Data.SqlClient"/>
  <add name="NerdDinnerConnectionString" connectionString="Data Source=localhost;Initial Catalog=NerdDinner;Integrated Security=True" providerName="System.Data.SqlClient"/>