Common IIS + ASP.NET Issues
|
Here are various things I've encountered while setting up and/or managing ASP.NET websites using IIS, and how I solved them. Feel free to email me additions, comments, and/or questions.
HTTP 404: The page cannot be found. (ASMX or ASPX)
IIS 6+ is setup to return a 404 on executable types that are unrecognized or prohibited. This is the case with both ASP.NET 1.1 and 2.0.
If you don't see the expected version of ASP.NET listed under "Web Service Extensions", it's typically because IIS was installed after .NET. You can run the aspnet_regiis.exe utility to remedy this:
- Open the "Internet Information Services (IIS) Manager" under "Administrative Tools".
- Navigate to the "Web Service Extensions" node.
- Select "ASP.NET v1.1.4322" or "ASP.NET v2.0.50727" in the right pane.
- Click "Allow".
If you don't see the expected version of ASP.NET listed under "Web Service Extensions", it's typically because IIS was installed after .NET. You can run the aspnet_regiis.exe utility to remedy this:
- Get to a command prompt, e.g. Start>Run "cmd".
- Enter "CD /D C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322" or "CD /D C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727" depending on which version of ASP.NET.
- Enter "aspnet_regiis.exe -i".
- Wait for the finished message; "Start installing ASP.NET (1.1.4322.0)" or "Start installing ASP.NET (2.0.50727.0)" depending on which version of ASP.NET.
- Follow the previous set of steps to enabled ASP.NET in Web Service Extensions.
A Windows Authentication dialog box is popping up when trying to view ASPX; it won't accept any credentials and eventually will display a "Not Authorized" error page.
ASP.NET is getting an Access Denied error when trying to use "C:\Windows\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\". The identity used by the application pool does not have read/write permissions to that directory.
"Service Unavailable"
Check the System Event Log (run "eventvwr /s"). You should see and Error and maybe a Warning as well from the W3SVC Source at the time you were trying to view the web site/service. One of these will give you a slightly more specific problem which should be resolved in this document.
"A failure was encountered while launching the process serving application pool 'blarg'. The application pool has been disabled."
The most likely cause is the identity specified could not be used for the application pool. In this case there should be a warning that occurred just before this error in the Event Log which is detailed below.
"The identity of application pool '%1' is invalid, so the World Wide Web Publishing Service can not create a worker process to serve the application pool. Therefore, the application pool has been disabled."
A user is considered invalid if it isn't a member of IIS_WPG (Internet Information Services Worker Process Group) or it hasn't been granted the right to logon as a service. To check and possibly fix the latter, follow these steps:
- Run Local Security Policy applet which is usually under Administrative Tools or you can Start>Run with "secpol.msc".
- Expand the Local Policies node and click User Rights Assignment.
- Open the "Log on as service" policy either by double-clicking or right-clicking and selecting Properties.
- Click "Add User or Group..." and enter the name of the user for the app pool's identity.
- Restart the machine. The security policy is only read on boot.
A FileNotFound exception is being thrown for a DLL and the filename is always different.
Generally this is caused by the constructor of components created on the fly with XmlSerializer, such as SOAP client classes. Make sure the user the process is running under (the identity of the application pool for websites) has read/write permissions to the system temp directory, i.e. "C:\WINDOWS\TEMP\".
"Configuration Error: File or assembly name Blarg, or one of it's dependencies, was not found."
This is the equivalent of the ol' "Module not found" error from regsvr32 which didn't tell you what it was looking for that it didn't find either. Most commonly this will be msvcr71d.dll, and it's because you're using a debug version of the assembly.
"Mutex could not be created."
This can happen on ASP.NET sites when you attempt to change application pools while IIS is still running. The surest fix is simply an IISRESET. Unless the IIS service itself is restarted, there doesn't appear to be any way to fix this.
"Parameter is incorrect."
If you get this when setting up a new website with the IIS Manager then it could be that the DefaultAppPool has been deleted. If that's the case, then just select an existing app pool in the website properties.
"No primary driver specified in configuration"
The ASP.NET application can't find its "web.config" file.