Microsoft .NET Framework SDK QuickStart Configuration Details

This page provides a detailed listing of the configuration steps performed by the .NET Framework QuickStart configuration program.  It also contains solutions to common problems related to the samples setup.

General SQL Server/SQL Server Express Information

In order for the database access samples to function properly, a named instance of Microsoft® SQL Server Express™ is required.  To download and install Microsoft SQL Server Express, please follow the instructions on the Microsoft SQL Server Express download page at http://go.microsoft.com/fwlink/?LinkId=31766.

Installing SQL Server 2005 instead of SQL Server Express

The user can also use ConfigSamples.exe to install a named instance or a default instance of SQL Server 2005 by passing in the switch /sql_instance:<named_instance>.

<sdk Install Path>\samples\setup\configsamples.exe /sql_instance:<MyInstanceName>

The SQL Server Express instance name used by the SDK samples is 'SQLExpress'.  To access the database, use the server name: (local)\SQLExpress.

<SDK Prompt> sqlcmd -S (local)\SQLExpress -E -d <database>

Installing the SDK Quickstart Tutorials Manually

The SDK Quickstart tutorials require Internet Information Server. For help installing Internet Information Server see the Windows Help documentation.

  1. Install and register ASP.NET with IIS
    1. From the SDK command prompt run aspnet_regiis -ir -enable
  2. Optional Install SQL Server Express or SQL Server 2005.
  3. Install the Quickstart Sample databases. From the SDK command prompt change to the SDK\v2.0\samples\setup folder and run the following commands
    1. sqlcmd -E -S (local)\SQLExpress -i InstPubs.sql
    2. sqlcmd -E -S (local)\SQLExpress -i InstNwnd.sql
    3. sqlcmd -E -S (local)\SQLExpress -i InstGrocer.sql
    4. sqlcmd -E -S (local)\SQLExpress -i InstContacts.sql
    5. sqlcmd -E -S (local)\SQLExpress -i InstPhotos.sql
    6. sqlcmd -E -S (local)\SQLExpress -i Inst_FileSystemSQL.sql
    7. aspnet_regsql.exe -S (local)\SQLExpress -E -A all
  4. Grant the ASP.NET User account access to the databases. On Windows Server 2003 the ASP.NET process runs under NT AUTHORITY\NETWORK SERVICE. In all other cases it runs under MACHINENAME\ASPNET.
    1. sqlcmd -E -S (local)\SQLExpress -Q "sp_grantlogin <ASP.NET User Account>"
    2. sqlcmd -E -S (local)\SQLExpress -d Pubs -Q "sp_grantdbaccess <ASP.NET User Account>"
    3. sqlcmd -E -S (local)\SQLExpress -d Pubs -Q "sp_addrolemember 'db_owner', <ASP.NET User Account>"
    4. sqlcmd -E -S (local)\SQLExpress -d NorthWind -Q "sp_grantdbaccess <ASP.NET User Account>"
    5. sqlcmd -E -S (local)\SQLExpress -d NorthWind -Q "sp_addrolemember 'db_owner', <ASP.NET User Account>"
    6. sqlcmd -E -S (local)\SQLExpress -d GrocerToGo -Q "sp_grantdbaccess <ASP.NET User Account>"
    7. sqlcmd -E -S (local)\SQLExpress -d GrocerToGo -Q "sp_addrolemember 'db_owner', <ASP.NET User Account>"
    8. sqlcmd -E -S (local)\SQLExpress -d Contacts -Q "sp_grantdbaccess <ASP.NET User Account>"
    9. sqlcmd -E -S (local)\SQLExpress -d Contacts -Q "sp_addrolemember 'db_owner', <ASP.NET User Account>"
    10. sqlcmd -E -S (local)\SQLExpress -d Photos -Q "sp_grantdbaccess <ASP.NET User Account>"
    11. sqlcmd -E -S (local)\SQLExpress -d Photos -Q "sp_addrolemember 'db_owner', <ASP.NET User Account>"
    12. sqlcmd -E -S (local)\SQLExpress -d FileSystemSQL -Q "sp_grantdbaccess <ASP.NET User Account>"
    13. sqlcmd -E -S (local)\SQLExpress -d FileSystemSQL -Q "sp_addrolemember 'db_owner', <ASP.NET User Account>"
    14. sqlcmd -E -S (local)\SQLExpress -d ASPNETDB -Q "sp_grantdbaccess <ASP.NET User Account>"
    15. sqlcmd -E -S (local)\SQLExpress -d ASPNETDB -Q "sp_addrolemember 'db_owner', <ASP.NET User Account>"
  5. Modify the Web.config file to point to the location that the QuickStart are installed to:
. . .
<sourceview>
     <add key="root" value="C:\Program Files\Microsoft.NET\SDK\v2.0\QuickStart" />
</sourceview>
. . .
If you are going to host the QuickStart to enable users from other machines to view and run the QuickStart, set the RemoteHosted appSetting key value to true in the web.config file. This will prevent your computer from hosting some samples that were not designed for use by un-trusted sources.
<appSettings>
     <add key="RemoteHost" value="true" />
</appSettings>
  1. If you installed SQL Server 2005 instead of SQL Express you will need to update the connection string used by all samples. Search the SDK\v2.0\QuickStart\ directory and replace all instances of "(local)\SQLExpress" with the connection string needed for your instance of SQL.
  2. Install all SDK Quickstart Virtual Directories in IIS. The Setup.xml installed to the SDK\v2.0\Samples\setup folder lists all of the SDK Quickstart virtual directories that need to be installed. The SDK Quickstart configuration wizard defaults to installing the virtual directories to the QuickstartV20 virtual directory path.
  3. If you are running IIS 6.0 you should create a separate unique application pool for the SDK Quickstart samples. The SDK Quickstart Configuration Wizard creates the "QuickstartV20AppPool" by default. Associate this application pool with the QuickstartV20 virtual directory.
  4. Set all appropriate security permission on the application pool that you created and the Quickstart Virtual directories to adequately protect your IIS server from attackers.
  5. After creating all Virtual Directories run "aspnet_regiis -s W3SVC/1/ROOT/QuickstartV20" from the SDK Command prompt to register the asp.net 2.0 script map for the Quickstart Virtual Directory.
  6. Optional - Build all of the Quickstart samples in the sdk\v2.0\Quickstart\ folder by calling msbuild on each sample solution file from within the SDK command prompt.

Running the QuickStart on the Windows Server 2003, 64-bit Windows XP, and newer Windows operating systems

Note: If you are installing the QuickStart on a Windows Server 2003, 64-bit Windows XP, or newer Windows operating systems, ASP.NET Web Server Extensions must be 'Allowed' for the QuickStart to work. See the 'Enabling and Disabling Dynamic Content' section of the IIS help documentation for more information.

Resolving the ".NET Framework SDK installation (not found)" Error in ConfigSamples.Exe

The samples configuration utility will return a ".NET Framework SDK installation (not found)" error if it does not detect an installation of the corresponding version of the .NET Framework SDK. If you receive this error, please confirm that the registry key created by the .NET Framework SDK (HKLM\SOFTWARE\Microsoft\.NETFramework\sdkInstallRootv2.0) exists. If this registry key does not exist, it indicates that the .NET Framework SDK was not installed or that the installation did not complete successfully. In this case, please reinstall the .NET Framework SDK.

Installing Additional Fonts

The ASP.NET Quickstart Localization samples require several fonts (e.g. Japanese) to view the samples correctly.  The installation procedure for these fonts may require the original Windows CD. To install new fonts, complete the following steps:

On Windows 2000

On Windows XP or Windows 2003

Installing SQL Server Express

1. ERROR: SQL Server Express Installation Failed

This is a general SSE installation error message. Please go to Start -> Settings -> Control Panel -> Administrative Tools -> Services and look for the service named "SQL Server (SQLEXPRESS)". If it is there, please start it. If it is not there, please run ConfigSamples.exe again.

For more information, please go to http://lab.msdn.microsoft.com/vs2005/get/vsbeta2installissues/default.aspx#sse.

2. ERROR: SQL Server Express Download Failed

Please try and manually download the SSE installation package. To download the 32-bit-only SSE (32MB), please go to http://go.microsoft.com/fwlink/?LinkId=47324. To download the 32/64 bit SSE (70MB), please go to http://go.microsoft.com/fwlink/?LinkId=39581. Please then re-run the ConfigSamples.exe, and when you reach the page that sets the options for the SQL Server Express, select the second option "Download from the local machine" and browse to the downloaded location.

ConfigSamples Command Line Parameters

The SDK Quickstart Setup utility provides the following command line parameters to make setup and uninstall of the QuickStart easier.

Usage: ConfigSamples [-?] [-q] [-v] [-sql_instance:name]

Parameter Details
-? Show parameter usage information
-q Run in quiet mode. No UI is displayed. Default values will be selected if not specified by a switch. By default SQL Express is downloaded and installed by ConfigSamples.
-v Show verbose information. Verbose log information will be displayed to the console instead of the standard log file is this switch is specified.
-i Ignore install failures. Do not rollback changes. The -i switch can be to force ConfigSamples to install the QuickStart even when there are installation problems.
-uninstall This option will cause ConfigSamples to remove the Quickstart Virtual directories and compiled binaries from you computer. It will not remove SQL Server Express or uninstall the sample databases.
-enable_aspnet This option will enable ASP.NET in IIS if it was not previously installed and enabled.
-skip_sqlexpress Skips the download and installation of SQL Server Express
-sql_instance:<name> This option allows you to specify your own SQL Server instance name. If you do not specify an instance name as the parameter ConfigSamples will attempt to install to the default SQL Server instance. By default ConfigSamples will try to install the SQLServerExpress named SQL instance.

ConfigSSE Command Line Parameters

ConfigSSE was designed to allow you to install SQL Server Express and the SDK Sample databases without setting up the rest of the QuickStart.

Usage: ConfigSSE [-?] [-q] [-v] [-sql_instance:name]

Parameter Details
-? Displays usage information
-q Runs in silent mode. No UI is displayed and defaults are selected. By default SQL Server Express is downloaded and installed.
-v Verbose mode. Logging information is displayed in the command prompt.
-i Ignores all setup errors.
-sql_instance:<name> This option allows you to specify your own SQL Server instance name. If you do not specify an instance name as the parameter ConfigSamples will attempt to install to the default SQL Server instance. By default ConfigSamples will try to install the SQLServerExpress named SQL instance.

Scrubbing Pre-Existing Data Files

If database files with the same filename already exist on the hard drive, the samples configuration utility will not overwrite/replace these files.  There are two ways to correct this problem:
1.  Delete or rename the following files from the C:\Program Files\Microsoft SQL Server\MSSQL$SQLExpress\Data directory.

2a.  Complete the instructions outlined in the Adding the SQL Server Databases to SQL Server Express and Granting Access to the ASPNET user sections above.
2b.  Or, run the samples configuration utility (ConfigSamples.exe) again.
 

Setting the NetSamplePath Environment Variable

The NetSamplePath environment variable is required to compile the QuickStart samples.  Set the NetSamplePath environment variable to <SDK> directory.  The <SDK> directory name must be in the short form (no spaces).  For an example of what NetSamplePath should be set to, see the SDKVars.bat file located in the <SDK>\Bin directory.

The process of setting an environment variable varies depending on your operating system.  In general, the command is:

Grant a New User Account Access to a Database

Please replace DATABASE NAME with the name of the database and replace USER NAME with the name of the user account.

  1. sqlcmd -E -S (local)\SQLExpress -Q "sp_grantlogin < USER NAME >"
  2. sqlcmd -E -S (local)\SQLExpress -d DATABASE NAME -Q "sp_grantdbaccess < USER NAME >"
  3. sqlcmd -E -S (local)\SQLExpress -d DATABASE NAME -Q "sp_addrolemember 'db_owner', < USER NAME >"

How to run the Quickstarts as Normal User

If you need to connect to the SSE using a normal user account as oppose to an administrator account, for all instances where you would otherwise use

sqlcmd -E .....

please use

sqlcmd -U <Username> -P <Password> .....

instead. Also, since you will no longer be using Integrated security for your web site, then the connection strings located in the web.config files need to be changed to the following format:

<add name="DatabaseName" connectionString="Server=ServerName; Database=DatabaseName;User ID=UserName;Password=Password;" providerName="System.Data.SqlClient" />

from the previous format:

<add name="DatabaseName" connectionString="Server=ServerName;Integrated Security=True;Database=DatabaseName;Persist Security Info=True" providerName="System.Data.SqlClient" />

How to Give Network Service the Write Access

If your current identity (NT AUTHORITY \ NETWORK SERVICE) does not have write access, including the temporary directory, please run the following command to grant the appropriate permissions:

<SDK Prompt>aspnet_regiis -ga "NT Authority\Network Service"


Copyright © 2005 Microsoft Corporation. All rights reserved.