Setting up a ASP.NET State Server

As you know, given the nature of HTTP, “blocking” takes place in attempting to interact with a website. You click and wait, and cannot do more than just wait for the existing “transaction” to complete.
Ala “Web Gardens” in IIS, which is a means of providing more than one worker thread to allow for multiple concurrent HTTP Transactions.Now for this to work, what is needed is a “STATE” server, where the website is user by more than one customer or end-user. So let’s begin:
Assumptions: (a) Windows 2008 (b) IIS 7

  1. Download SQL Server 2008 from Microsoft (Make sure you get it with the “Tools”) You get both in an EXE
  2. Download Service Pack 1 as well.
  3. During Install at Instance Configuration set you Named Instance Name – ASPState (and instance ID the same)
  4. Set Account Name in Server Configuration (of installation) to SYSTEM and change Startup Type to Automatic on both
  5. Setup Mixed Mode in Database Engine Configuration – add in Password and Current User
  6. Start up Microsoft SQL Server Management Studio and see if you can login (should ensure your DB installed correctly)
  7. Run SQL Server Configuration Manager – go to SQL Server Network Configuration – Enable TCP/IP
  8. Go to it’s Properties – Ip Addresses – Enable on Interface you desire – Set TCP Port on IP all to 1433
  9. Ensure SQL Server is running and SQL Server Browser under SQL Server Services
  10. Restart SQL Server – run netstat -an to ensure the port 1433 is running 
  11. Create the STATE Database – Next run from the Microsoft.NET v4 folder (your latest) – aspnet_regsql.exe -S <servername> -E -ssadd -sstype p
  12. Check Server Management Studio to make sure the Database has been created
  13. Create a DB User with Permissions – Under (Overall not for your database specifically) Security -> New User -> “ASP” (custom name)
  14. Choose SQL Server Authentication – Choose Default Database “ASPState” (whatever you named yours)
  15. Next go into IIS to setup your Configuration
  16. In IIS for your website, change Connection String to Connect to your Database you setup (not sure how necessary this part is, but I did it anyways)
  17. Choose SQL Server and Specify Credentials -> Server = <your hostname> | Database: ASPSTATE
  18. Specify User Name: ASP etc.
  19. Next In the Main Configuration for your Site – Choose Session State (Required)
  20. Click SQL Server – and type in the details mentioned afore – Don’t forget to Apply
  21. Restart Site and Try Hit – should have a working website with State. You can log onto SQL Studio to confirm 
  22. If you are still experiencing problems which you will see through accessing the WebSite it is most likely “DB Permissions”.
  23. I right-clicked on Properties of the Database I created (AsPState) and set the Permissions for the User I created

I’m sure there are easier ways to do this and more secure. But this was my first SQLExpress install and State Server – so it’s good for now.

Don't be shellfish...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on TumblrEmail this to someone

Leave a Reply