Unanswered Stuck on Step #1!

  • Monday, October 23, 2006 8:58 AM
     
     

    I'm trying to load in the code to a tutorial that requires SQL Server.  Step number one on the install instructions says:

    Set Up The Database

    You may choose to set up your own Northwind database or restore the included Northwind.bak. Regardless of which approach you take you will need to grant your local [MachineName]\ASPNET account access to Northwind and then execute GenerateStoredProcedures.sql against it to create the stored procedures. If you receive a message "There is no such user or group 'aspnet'." you may need to search and replace "ASPNET" with "[your machine name]\ASPNET"

    I'm using SQL Server Express and the SQL Server Management Studio Express, and well...I'm already stuck.  I'm trying to create a new user named ASPNET from the management Studio.  I don't see any UI that mentions creating user accounts, and the closest thing is LOGIN accounts.  So I created a ASPNET login account, and the disconnected from SQL Express and tried to login as ASPNET.  When I do this, I get an error that reads:

    Login failed for user 'aspnet'. The user is not associated with a trusted SQL server connection. ERROR: 18452

    suprisingly, every SQL Express tutorial that I could find never seems to mention anything about creating a user account.  Can someone clue me in to what I am doing wrong?  Or point me to a SQL Express tutorial that explains user accounts or logins so I can move on to step #2.

    Thanks, -=Me=-

All Replies

  • Monday, October 23, 2006 4:43 PM
     
     

    You should know that you need a Log In to SQL Server 2005 Express, and be a User of the Northwind database.

    Are you sure you created a login for [MachineName\ASPNET] ie if your pc is named Rocket then the login name should be [Rocket\ASPNET]? Also, you have to add ASPNET as a user in Northwind. You can do this by expanding Northwind, then Security, then Users. You can right-click Users and select New User from the context menu. Enter the user name you want and then choose [MachineName\ASPNET] as the login.

    I hope this helps you to fix your problem.

     

     

  • Monday, October 23, 2006 6:59 PM
    Moderator
     
     

    The ASPNET user is automatically created on your computer when you install IIS and the .NET Framework. (In that order) You'll need to confirm that you actually have an ASPNET user on your computer using the Computer Manager or what ever mechanism you prefer to examine users on your computer. Once you've confirmed the user exists, you give permissions to this user as follows:

    1. Open the Security node in SSMSE, right click on Logins and select New Login.
    2. Fill in <machine name>\ASPNET for the Login Name.
    3. Select Northwind as the Default database.
    4. Switch to the User Mappings tab and check Northwind.
    5. In the Database Role section, check db_owner.
    6. Click OK.

    This should add a Login to SQL Express for your ASPNET user and create a Database User that has the permissions of the database owner. This should be suitable for playing with the sample.

    It's worth pointing out that you probably wouldn't give db_owner permissions to ASPNET for production system as this is the account that any random user comming in through ASP.NET will be using. Rather, you would give appropriate permission levels to the account, or even consider setting up your application to run under an Application Pool with a specific user account created just for that application, and give that user the appropriate permissions. For more information about this check out online documentation:

    SQL Server security: http://msdn2.microsoft.com/en-us/library/ms161948.aspx

    Application Pools: http://msdn2.microsoft.com/en-us/library/ms998297.aspx

    Mike