Skip to contentSkip to author details

IIS

A 3-post collection

IIS HTTP Error 500.19 - Internal Server Error

Written by Michael Earls
 IIS

I just installed a web application on a new server and I received the following error:

HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid.

The lines it showed on the web.config were -1: and 0: with no config file information like it would normally display for malformed XML within the configuration file.

Well, after searching the web, I was unable to find a solution. Then I remembered that I was using URL rewriting. I installed the URL rewriting module for IIS 7 and restarted the site. It worked like it should.

Edit: I’m not using URL rewriting, but I do have the 404 Error redirection turned on. Maybe it uses URL rewriting behind the scenes.

Http Error 503 - Service Unavailable with .NET 4 - IIS

Written by Michael Earls
 .NET  ASP.NET  IIS

When trying to debug my web service today after upgrading the project to .NET 4, I was told by Visual Studio that it could not debug and to try running the project outside the browser. When I did, I received a 503 Error, Service Unavailable.

I check the Event Log and found this:

The worker process for application pool 'PartsWebService' encountered an error 'Cannot read configuration file due to insufficient permissions ' trying to read configuration data from file '\?C:WindowsMicrosoft.NETFrameworkv4.0.30319CONFIGmachine.config', line number '0'. The data field contains the error code.

Simple enough, I just have to give the correct permissions to that file. It seems that my service’s application pool identity doesn’t have rights. So I’ll navigate to the path that contains the machine.config and set permissions there.

You can’t just set permissions on the parent folder, you have to give permissions to the machine.config file itself. Add IIS_IUSRS from your local machine to the read and execute roles.

Also, load IIS Manager and check your application pool as this error usually stops the application pool if it’s running.

This should clear up any issues you were having.

IIS Error Message - An attempt was made to load a program with an incorrect format.

Written by Michael Earls
 32-Bit  64-Bit  ASP.NET  IIS

If you receive the following error message when running a website (usually after deploying onto a 64-bit machine):

Could not load file or assembly ‘PROJECTNAME’ or one of its dependencies. An attempt was made to load a program with an incorrect format.

It could indicate that your web app (or one of its dependencies) was built for x86 and 32-bit applications are turned off in your application pool.

  1. Open IIS Administration Tool
  2. Click on sites
  3. Click on the site you’re trying to run
  4. On the right side, click on “Advanced Settings”
  5. A dialog box pops up with information about the site in it
  6. Look for the name of the Application Pool
  7. Close this window
  8. Click on “Application Pools” in the tree on the left
  9. Click on the Application Pool from the screen you just looked at
  10. Click on “Advanced Settings” on the right
  11. Look at the value for “Enable 32-Bit Applications”
  12. Make sure this is set to True (it is False by default)

You could also recompile your project for x64, but any dependencies you have might not work.