Blog Stats
  • Posts - 4
  • Articles - 0
  • Comments - 1
  • Trackbacks - 0

 

Monday, October 23, 2006

SQLExpess supported at my host


Wow it looks like SQL Server Express is supported!  My host had the following on their Knowledge Base. 

1) Please make sure you have Initial Catalog=xxxxx in your connection string. You may sometimes receive an error regarding the log file. You can simply rename or remove the old log file, the application will attempt to create a new one.  If it doesn't work, please try the following connection string as well:

2) Make sure you grant the folder "app_data" with read/write/execute/modify (or delete) permission on the Network Service user.

3) Make sure you only upload the .mdf file into the "app_data" folder (Do not upload .ldf file or you will receive errors saying database with the same name exists in the server).

Please make sure your connection string in your web.config is like below

<add name="LocalSqlServer" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;user instance=true;Integrated Security=True;Initial Catalog=ASPNETDB;"  providerName="System.Data.SqlClient" />

(If you are using a deployment project then make sure you enable web.config section replacement and put the connectionStrings section in there, like this: connectionStrings=connectionStrings.config;)

Excellent.  Just have to try it out along with the Data Access Application block from the new Enterprice Library for .NET Framework 2.0

Connecting to SQL Server Express


Trying to figure out the best way to connect to SQl Server express for VS2005 Web development is quite interesting.  You may be able to connect from vs2005 and the new SQL Server Management studio but when it comes time to run your aspx page against a connection you need to do a little extra work.

 

First thing is security.  If you are using integrated security the ASPNET account needs access to your database.  I found there is more than one way to do this which adds to the confusion.

 

Option 1)  Attach the mdf file to your running instance of sql server express.  Add the local ASPNET Login under Security for SQLExpress and then add then again as a User under security for your database instance.  Be sure to grant the User enough access.

 

Then you can connect using something like this:

 

Database=<dbName>;

Server=(local)\SQLEXPRESS;

Integrated Security=SSPI;

 

Option 2) I later leraned the DB does not need to be explicitly attached but can be refenced using AttachDBFileName=<path_to_mdf>

 

Data Source=.\SQLEXPRESS;

AttachDBFilename=<path_to_mdf>;

Integrated Security=True;

User Instance=True;

 

The problem here is security.  When the MDF is access on the fly like this the ASPNET account must be given access to the MDF (and log) file using Windows XP Secrity.

 

The question for me now is will this work at my hosting provider?

Saturday, March 04, 2006

Essentials for migrating from vs2003 to vs2005 asp.net


Project files for web application are pretty much essential for me and getting them back is the first essential item for a smooth vs2005 migration.  Download it from here:

Visual Studio 2005 Web Application Projects (Beta V2 Preview)

If you actually want to deply your web projects you again need to get some additional beta code from microsoft.

Visual Studio 2005 Web Deployment Projects (Beta V2 Preview)

The good news is that these beta add-ins actually work pretty well.  You need to read the instructions (thank you Scott G).

Visual Studio 2005 Web Application Project preview!


After a month of severe pain trying to make our web applications fit into the new vs2005 project-less web sites we discovered the Visual Studio 2005 Web Application Project preview!  Looks like someone finally came ot their senses.  My feelings are somewhere between releif that they put project back into web sites and anger that it was not thete in the first place.  It's all laid out for you at http://webproject.scottgu.com/ and the best news is that it actually works just like vs2003 web projects used to with all the vs2005 enhancements...very cool and better late than never.

 

 

 

Copyright © Fred Sobel