I recently ran into the classic SQL Server connection error message "Login failed". This, of course, nearly always has to do with insufficient rights to the database.
However, I also got this error message:
Login failed for user 'IIS APPPOOL\DefaultAppPool
In this case, I tried to anonymously connect to a SQL Server Database (in Windows 7, mind).
This is how to solve the problem:
- In Internet Information Services, right click the website that tries to connect to the database->choose Manage Web Site -> Advanced Settings. Take a look at the Application Pool used, in this case DefaultAppPool:

- Now that you know the application pool the website uses, instead right click Application Pools (in IIS root) -> right click the correct application pool -> choose Advanced Settings.
- Under Advanced Settings, find Identity and choose LocalService as the Built-in account:

- Done!
Sometimes you want different authentication modes with your ASP.NET website. Normally, you can enable and disable a number of authentication modes in IIS under the Authentication section for your website, but there may be a scenario where a couple of these authentication modes are missing.
To resolve this problem, you have to enable these under Windows Features:
- Go to Control Panel->Programs and Features, choose Turn Windows Features on or off.
- Navigate to Internet Information Services->World Wide Web Services->Security and tick the desired authentication modes:

If you get the login failed error message for your SQL Server database, then it's a good idea to make sure that everything runs as it should. Here's a post on how you get SQL Server 2008 up and running.
Make sure:
- The SQL Server Browser service is running.
You can find it under Services (Control Panel->Administrative Tools->Services)
- TCP/IP is activated.
You can activate TCP/IP through SQL Server Configuration Manager, under SQL Server Network Configuration->Protocols for (SQLEXPRESS). Right click TCP/IP in the list to activate.
- SQL Server and Windows Authentication mode is activated.
In SQL Server Management Studio, right click your instance->Properties->Security and tick SQL Server and Windows authentication mode.
- Remote Connections are allowed for your SQL Server instance.
In SQL Server Management Studio, right click your instance->Properties->Connections and tick Allow remote connections to this server.
Last, but not least - make sure your SQL Server database credentials are correct! Mind the server, database name, user and password.
I ran into problems with IIS and ASP.NET after I installed Windows 7, so I thought I'd share my then successful installation process with you.
Clean install of Win 7
First of all, a clean installation of Windows 7 is preferred. I recommend you this because it's otherwise possible you encounter a strange problem which has to do with an upgrade.
A clean installation of Windows 7 will always minimize your problems, plus it's the best start you can get.
First instructions
To minimize upcoming problems, the best thing to do is to install the .NET developer tools before you install anything else.
Make sure you install these tools before anything else and your installation will probably as smooth as anything.
My successful installation process went like this:
- Enable IIS and ASP.NET
- Install SQL Server 2008 + Management Studio (plus ASP.NET MVC)
- Install Visual Studio 2008 + Service Pack 1
Enable IIS and ASP.NET
After the installation of Windows 7 is done, it's first time for IIS and ASP.NET.
You'll have to enable these features through Windows Features which is located under Programs and Features in the Control Panel.
In the Windows Features window, make sure the following options are ticked:
- Internet Information Services (you can also activate IIS 6 under Web Management Tools->IIS 6 Management Compatibility)
- ASP.NET (under World Wide Web Services->Application Development Features)

Use Web Platform Installer to install SQL Server and ASP.NET MVC
Microsoft Web Platform Installer is an awesome tool which will help you install programs, modules and much more related to .NET development. Use Web Platform Installer to install the following:
- SQL Server 2008 + SP1
- SQL Server Management Studio Express
- ASP.NET MVC
Once you've downloaded and installed Web Platform Installer, activate the features under the Web Platform tab:

The installer will automatically download and install all your selected features. Gone are the days with meaningless steps in the SQL Server installation process!
Mind, you can also choose to install a whole lot of other features, but I recommend you to save them for later.
Install Visual Studio 2008 + SP1
Final step is to install Visual Studio 2008 and Service Pack 1.
Once this is done, you should be set and everything should be fine.
If problems occur
If you encounter any problems, it's always a good shot to use your search engine to find anything related to the problem.
I tried a lot of different solutions though and no solution helped me - a clean installation and the above installation flow solved my problems.
Remote Desktop is awesome when you need to connect to another PC and work as if you were sitting in front of it. Remote Desktop is simple to use, you just have to know how to enable it. Here's how:
- Click the start button, right click Computer and choose Properties:

- At Control Panel Home, choose Remote settings:

- Finally, set your desired option in the Remote tab:

Here you can choose the less or more secure option, depending on your Windows version. For most Windows versions, the latter option with Network Level Authentications is recommended.
Also, make sure your firewall allow remote desktop connections.
You'll find the Windows Firewall under Control Panel -> All Control Panel Items -> Windows Firewall. Choose Allow a program or feature through Windows Firewall to change the options.