Web config ошибка 500

This is driving the whole team crazy. There must be some simple mis-configured part of IIS or our Web Server, but every time we try to run out ASP.NET Web Application on IIS 7.5 we get the following error…

Here’s the error in full:

HTTP Error 500.19 - Internal Server Error

The requested page cannot be accessed because the related configuration  
data for the page is invalid.

`Detailed Error Information` 
Module              IIS Web Core
Notification        Unknown
Handler             Not yet determined
Error Code          0x8007000d
Config Error
Config File         \\?\E:\wwwroot\web.config
Requested URL       http://localhost:80/Default.aspx
Physical Path 
Logon Method        Not yet determined
Logon User          Not yet determined
Config Source
   -1: 
    0: 

The machine is running Windows Server 2008 R2. We’re developing our Web Application using Visual Studio 2008.

According to Microsoft the code 8007000d means there’s a syntax error in our web.config — except the project builds and runs fine locally. Looking at the web.config in XML Notepad doesn’t bring up any syntax errors, either. I’m assuming it must be some sort of poor configuration on my part…?

Does anyone know where I might find further information about the error? Nothing is showing in EventViewer, either :(

Not sure what else would be helpful to mention…

Assistance is greatly appreciated. Thanks!

UPDATES! — POSTED WEB.CONFIG BELOW

Ok, since I posted the original question above, I’ve tracked down the precise lines in the web.config that were causing the error.

Here are the lines (they appear between <System.webServer> tags)…

    <httpHandlers>
        <remove verb="*" path="*.asmx"/>
        <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=f2cb5667dc123a56"/>
    </httpHandlers>

Note: If I delete the lines between the <httpHandlers> I STILL get the error. I literally have to delete <httpHandlers> (and the lines inbetween) to stop getting the above error.

Once I’ve done this I get a new 500.19 error, however. Thankfully, this time IIS actually tells me which bit of the web.config is causing a problem…

    <handlers>
        <remove name="WebServiceHandlerFactory-Integrated"/>
        <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory,System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=f2cb5667dc123a56"/>
        <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=f2cb5667dc123a56"/>
        <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=f2cb5667dc123a56"/>
    </handlers>

Looking at these lines it’s clear the problem has migrated further within the same <system.webServer> tag to the <handlers> tag.

The new error is also more explicit and specifically complains that it doesn’t recognize the attribute «validate» (as seen on the third line above). Removing this attribute then makes it complain that the same line doesn’t have the required «name» attribute. Adding this attribute then brings up ASP.NET error…

Could not load file or assembly
‘System.web.Extensions,
Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=f2cb5667dc123a56’ or
one of its dependencies. The system
cannot find the file specified.

Obviously I think these new errors have just arisen from me deleting the <httpHandlers> tags in the first place — they’re obviously needed by the application — so the question remains: Why would these tags kick up an error in IIS in the first place???

Do I need to install something to IIS to make it work with them?

Thanks again for any help.

WEB.CONFIG

Here’s the troublesome bits of our web.Config

<system.Web>

<!-- stuff cut out -->

    <httpHandlers>
        <remove verb="*" path="*.asmx"/>
        <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=f2cb5667dc123a56"/>
        <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=f2cb5667dc123a56"/>
        <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=f2cb5667dc123a56" validate="false"/>
    </httpHandlers>
    <httpModules>
        <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=f2cb5667dc123a56"/>
    </httpModules>
</system.web>

<system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules>
        <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=f2cb5667dc123a56"/>
    </modules>
    <remove verb="*" path="*.asmx"/>
    <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=f2cb5667dc123a56"/>
    <handlers>
        <remove name="WebServiceHandlerFactory-Integrated"/>
        <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory,System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=f2cb5667dc123a56"/>
        <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=f2cb5667dc123a56"/>
        <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=f2cb5667dc123a56"/>
    </handlers>
</system.webServer>

The HTTP Error 500.19, also known as Internal Server Error, is a common issue faced by ASP.NET developers. This error usually occurs due to incorrect configuration of the server and the website, invalid sections in the configuration file, or missing modules or handler mappings in the IIS.

Method 1: Check Configuration File

When you encounter HTTP Error 500.19 in IIS for your ASP.NET application, it usually means that there is an issue with your web.config file. One way to fix this issue is to use the «Check Configuration File» option in IIS Manager. Here are the steps to do this:

  1. Open IIS Manager and select your website or application.
  2. In the Features View, click on «Configuration Editor».
  3. In the «Section» drop-down list, select «system.webServer».
  4. In the «From» drop-down list, select «Full».
  5. In the «Section» drop-down list, select «configuration».
  6. Click on the «Check Configuration» button at the top of the screen.

If there are any errors or warnings in your web.config file, they will be displayed in the «Results» pane. You can click on each error or warning to see more details about the issue.

Here are some examples of common errors and how to fix them:

Error: «Unrecognized attribute ‘targetFramework’.»

This error occurs when you are using an outdated version of the .NET Framework. To fix this, update your web.config file to use the correct version of the .NET Framework. For example:

<configuration>
  <system.web>
    <compilation targetFramework="4.7.2" />
  </system.web>
</configuration>

This error occurs when there is a syntax error in your web.config file. To fix this, carefully review your web.config file and correct any syntax errors. For example:

<configuration>
  <system.web>
    <compilation debug="true" />
  </system.web>
</configuration>

Warning: «The configuration section ‘system.webServer/handlers’ cannot be read because it is missing a section declaration.»

This warning occurs when you are missing a required section in your web.config file. To fix this, add the missing section to your web.config file. For example:

<configuration>
  <system.webServer>
    <handlers>
      <add name="ApiURIs-ISAPI-Integrated-4.0" path="*.api" verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
  </system.webServer>
</configuration>

By using the «Check Configuration File» option in IIS Manager, you can quickly identify and fix issues with your web.config file that are causing HTTP Error 500.19.

Method 2: Install Required Modules in IIS

To fix the IIS HTTP Error 500.19 in Asp.Net, you can install required modules in IIS. Here are the steps to do it:

  1. Open the IIS Manager and select the server node.
  2. Click on the «Server Manager» option and select «Add Roles and Features».
  3. Click Next until you reach the «Features» section.
  4. Expand the «.NET Framework 4.5 Features» node and select «ASP.NET 4.5».
  5. Expand the «WCF Services» node and select «HTTP Activation».
  6. Expand the «Web Server (IIS)» node and select «Web Server».
  7. Expand the «Web Server» node and select «Application Development».
  8. Select the «ASP.NET 4.5» checkbox.
  9. Click Next and install the required features.

After installing the required modules, you need to configure the application pool to use the correct .NET Framework version. Here’s how to do it:

  1. Open the IIS Manager and select the application pool for your application.
  2. Click on the «Advanced Settings» option.
  3. Under the «General» section, select the correct .NET Framework version.
  4. Click OK to save the changes.

You can also set the permissions for the application’s folder to allow the application pool to access it. Here’s how to do it:

  1. Right-click on the application’s folder and select «Properties».
  2. Click on the «Security» tab and click «Edit».
  3. Click «Add» and enter the name of the application pool.
  4. Click «Check Names» and click «OK».
  5. Set the permissions for the application pool to «Modify», «Read & execute», «List folder contents», and «Read».
  6. Click OK to save the changes.

By installing the required modules, configuring the application pool, and setting the permissions for the application’s folder, you should be able to fix the IIS HTTP Error 500.19 in Asp.Net.

Method 3: Modify Web.config File

To fix IIS HTTP Error 500.19 in ASP.NET, you can modify the Web.config file. Here are the steps:

  1. Open the Web.config file in your project.
  2. Look for the <system.webServer> tag and add the following code inside it:
<modules runAllManagedModulesForAllRequests="true"/>
  1. Look for the <handlers> tag and add the following code inside it:
  1. Save the changes to the Web.config file and restart the IIS server.

Here is the modified Web.config file:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <handlers>
      <remove name="WebDAV" />
    </handlers>
  </system.webServer>
</configuration>

Method 4: Verify File Permission

To fix the IIS HTTP Error 500.19 in Asp.Net, you can verify file permission. Follow the steps below:

  1. Open IIS Manager and select the website that is causing the error.

  2. Click on the «Authentication» icon and make sure that «Anonymous Authentication» is enabled.

  3. Right-click on the website and select «Edit Permissions» from the context menu.

  4. In the «Security» tab, click on the «Edit» button and add the user «IIS_IUSRS» with full control permissions.

  5. Click on the «Advanced» button and make sure that the «Inherit from parent the permission entries that apply to child objects» checkbox is checked.

  6. Click on the «OK» button to close all the windows.

  7. Restart the website and check if the error is fixed.

using System.Security.AccessControl;
using System.IO;

string path = @"C:\inetpub\wwwroot\MyWebsite";
DirectoryInfo dInfo = new DirectoryInfo(path);
DirectorySecurity dSecurity = dInfo.GetAccessControl();
dSecurity.AddAccessRule(new FileSystemAccessRule("IIS_IUSRS", FileSystemRights.FullControl, InheritanceFlags.ObjectInherit | InheritanceFlags.ContainerInherit, PropagationFlags.None, AccessControlType.Allow));
dInfo.SetAccessControl(dSecurity);
<configuration>
  <system.webServer>
    <security>
      <authentication>
        <anonymousAuthentication enabled="true" />
      </authentication>
      <access sslFlags="Ssl,SslNegotiateCert,SslRequireCert" />
      <authorization>
        <add accessType="Allow" users="*" />
      </authorization>
    </security>
  </system.webServer>
</configuration>

These code snippets add the «IIS_IUSRS» user with full control permissions to the website directory and enable anonymous authentication in the web.config file.

Method 5: Reinstall .NET Framework

If you’re encountering HTTP Error 500.19 while running an ASP.NET web application on IIS, one of the possible solutions is to reinstall .NET Framework. Here are the steps to do it:

  1. Uninstall .NET Framework
Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -Recurse | Get-ItemProperty -Name Version, Release -EA 0 | Where { $_.PSChildName -Match '^(?!S)\p{L}'} | Select Version, Release

& "$env:windir\Microsoft.NET\Framework\v4.0.30319\SetupCache\Client\setup.exe" /uninstall /x86 /x64 /passive /norestart
  1. Download .NET Framework

Go to the Microsoft .NET Framework website and download the version you’ve just uninstalled.

  1. Install .NET Framework
& "$env:windir\Microsoft.NET\Framework\v4.0.30319\SetupCache\Client\setup.exe" /passive /norestart
  1. Restart IIS

After completing these steps, your ASP.NET web application should be able to run without encountering HTTP Error 500.19.

This is my web.config file contents:

<?xml version="1.0"?> 

<configuration> 

    <system.webServer>
    <httpErrors errorMode="Detailed" />
        <asp scriptErrorSentToBrowser="true"/>
        <rewrite>
            <rules>
                <rule name="Main Rule" stopProcessing="true">
                    <match url=".*" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php" />
                </rule>
            </rules>
        </rewrite>

     </system.webServer>

    <system.web>
        <customErrors mode="Off"/>
        <compilation debug="true"/>
    </system.web>
</configuration>

I’m trying to use pretty permalinks of wordpress.

But this web.config files causes 500 Internal Server Error.

What is the problem?

  • iis-7
  • web-config

pnuts's user avatar

pnuts

58.4k11 gold badges87 silver badges140 bronze badges

asked Mar 13, 2012 at 13:16

Mahdi Ghiasi's user avatar

Mahdi GhiasiMahdi Ghiasi

14.9k19 gold badges72 silver badges119 bronze badges

2 Answers

The problem was from the server, they have not installed Microsoft URL Rewriting Module correctly…

The module has been installed correctly, and then problem solved.

answered Apr 7, 2012 at 21:32

Mahdi Ghiasi's user avatar

Mahdi GhiasiMahdi Ghiasi

14.9k19 gold badges72 silver badges119 bronze badges

1

answered Sep 19, 2018 at 0:21

vatzkie's user avatar

If your Internet Information Services (IIS) produces a 500 – Internal server error, your website is in serious trouble. Debugging an IIS 500 – Internal server error can take some time, so you’d better be prepared for the worst-case scenario. You don’t want to research how to deal with this error under time pressure.

Contents

  1. Cause of 500 – Internal server error
  2. Debugging an IIS 500 – Internal server error
  3. Resolving an IIS 500 – Internal server error
  4. Common 500.x substatus codes
  • Author
  • Recent Posts

Surender Kumar has more than twelve years of experience in server and network administration. His fields of interest are Windows servers, Active directory, PowerShell, web servers, networking, Linux, virtualization, and Kubernetes. He loves writing for his blog.

Latest posts by Surender Kumar (see all)

  • Kubernetes DaemonSets — Wed, Sep 6 2023
  • Static Pods in Kubernetes — Fri, Sep 1 2023
  • Encrypt Kubernetes Secrets at rest — Mon, Aug 28 2023

In my previous posts, you learned about detailed errors and failed request tracing in IIS (Internet Information Server). I recommend reading those articles first before you proceed with this one.

Cause of 500 – Internal server error

This is the most common error you will encounter with any website hosted with IIS. In most cases, a developer messed up. Thus, the fastest way is often to simply reverse the last action taken, such as restoring an earlier version of your web application. Once your system is running again, you can investigate the cause of the error on your test side in peace.

500 Internal server error

500 Internal server error

The HTTP 500 error is a server-side error. While we understand that the problem is on the server end, the error is usually ambiguous. It doesn’t exactly tell the administrator what is wrong with the server. Thus, debugging a 500 – Internal server error often takes some time.

Debugging an IIS 500 – Internal server error

Since the above error doesn’t really tell what’s actually wrong with the server, we need to enable detailed errors, as discussed in my previous post. Once detailed errors are enabled, you will see more detailed error information, including an HTTP substatus code. Sometimes even the detailed errors don’t show any useful information right away. For example, see the following screenshot:

The page cannot be displayed because an internal server error has occurred

The page cannot be displayed because an internal server error has occurred

Here I am getting: The page cannot be displayed because an internal server error has occurred. There is no HTTP status code or substatus code listed on the error page. If you get such an error even when detailed errors are enabled, right-click anywhere in the browser window and select Inspect (or press F12).

Opening developer tools in web browser to reveal server errors

Opening developer tools in web browser to reveal server errors

This opens the developer tools in your browser window. Now, click the Console tab. The actual error thrown by the web server is displayed.

Viewing server errors using the Console tab of the web browser's developer tools

Viewing server errors using the Console tab of the web browser’s developer tools

To further understand the exact cause of 500 errors, enable Failed Request Tracing, as discussed in my previous post. Now, try to replicate the problem. If you can replicate it, open the newly generated XML log file in a web browser. The following screenshot shows the actual cause of a 500 – internal server error with a substatus code of 19 (HTTP 500.19 error):

Determining the cause of a 500 error using the Failed Request Tracing log file

Determining the cause of a 500 error using the Failed Request Tracing log file

Usually, substatus code 19 indicates that the configuration data is invalid. This could be due to some malformed or unidentified element in a server-level config file (ApplicationHost.config) or website-level config file (web.config). If you take a closer look at the ConfigExceptionInfo field of the log file, you will find the exact line number (6 in our case) in the web.config file that caused the exception. Now let’s take a look at the web.config file itself.

Viewing the problematic element in the web.config file

Viewing the problematic element in the web.config file

Here, you can see that the developer tried to add a mime type in the config file, but it was already defined in the server-level configuration file (i.e., ApplicationHost.config). Therefore, the Cannot add duplicate collection entry of type ‘mimeMap’ with unique key attribute ‘fileExtension’ set to ‘.mp4’ exception was returned. Furthermore, if there is some unidentified element, a syntax error, or even a typo in the web.config file, you will most likely get a similar error.

Resolving an IIS 500 – Internal server error

To resolve an IIS 500 – Internal server error, you could simply remove the line that is causing the exception. Alternatively, if you don’t want to remove this line for some reason, add the following code right above line 6 in web.config:

<remove fileExtension=".mp4" />

By doing this, you are essentially overriding the server-level element. In the end, your web.config file should look as shown below:

Overriding the server level mime element with web.config file

Overriding the server level mime element with web.config file

Now refresh the page, and the error should go away. This was just one example of resolving a 500.19 error. If you get a 500 error with a different substatus code, use the same approach to troubleshoot the problem.

Common 500.x substatus codes

The following table covers some of the most common HTTP 500 substatus codes, along with their probable causes and troubleshooting advice:

Subscribe to 4sysops newsletter!

Status Code Probable Cause Troubleshooting Advice
500.11 The application is shutting down on the web server The application pool is shutting down. You can wait for the worker process to finish the shutdown and then try again.
500.12 The application is busy restarting on the web server This is a temporary error and should go away automatically when you refresh the page. If the error persists, something is wrong with the web application itself.
500.13 The web server is too busy This error indicates that the number of incoming concurrent requests exceeded the number that your IIS application can process. This could be caused when the performance settings are not right. To troubleshoot such issues, a memory dump needs to be captured and analyzed using tools such as Debug Diagnostic.
500.15 Direct requests for Global.asax file are not allowed A direct request was made for the Global.asa or Global.asax file, which is not allowed by the web server
500.19 The configuration data is invalid We already covered how to fix this error above
500.21 The module not recognized This status code is caused by a partial installation of the IIS server, such as missing ISAPI modules. To fix this error, identify the missing IIS components and install them.

Once you troubleshoot the problem, don’t forget to disable Failed Request Tracing and revert the detailed errors to custom errors on your web server.

При изменении «Настройки постоянных ссылок» на «Название записи» возникала ошибка 500.

Решение было найдено тут, а именно в корневой папке (где установлен WordPress) создаем файл web.config:

<?xml version="1.0"?>
<configuration>
  <system.webServer>
     <rewrite>
        <rules>
           <rule name="Main Rule" stopProcessing="true">
              <match url=".*" />
              <conditions logicalGrouping="MatchAll">
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
              </conditions>
              <action type="Rewrite" url="index.php" />
           </rule>
        </rules>
     </rewrite>
  </system.webServer>
</configuration>

Внимание! Вся графика должна начинаться с «/» (то есть от корня сайта) с полными ссылками будут проблемы. надо разобраться….

Для того что бы в IIS 7 — показать ошибку 500
В файл web.config добавьте следующий раздел:

<configuration>
 <system.webServer>
   <httpErrors errorMode="Detailed" />
 </system.webServer>
</configuration>

либо смотреть ошибку через ie на самом серваке.

Ошибка HTTP 500.0 — Internal Server Error

Ошибка HTTP 500.0 - Internal Server Error
В последнее время часто происходят сбои процесса FastCGI. Повторите запрос позже

Выяснилось, что в откуда то появилось два обработчика php, возможно при обновлении php или что то еще.

Симптомы и решение:

1. Заходим в Диспетчер служб IIS (IIS Manager) -> Страницу управления нашим сайтом -> Сопоставление обработчиков (Handler Mappings)
2. Сортируем по пути и видим две *.php строки
3. Удаляем не нужную
Пользуемся  :)
P.S. Изменения вносятся в web.config

Понравилась статья? Поделить с друзьями:
  • We like to read fairy tales исправить ошибки
  • Wearable lanterns ошибка профиль чтение запись поврежден
  • We not going to school today найдите ошибки
  • Warning case open detected как исправить ошибку
  • Warmos qx ошибка fl как исправить