Iis ошибка 500 внутренняя ошибка сервера

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.

You try to load your classic ASP (Active Server Pages) website and all you can see in your browser is the all too familiar display of 500 Internal Server Error.

This page isn't working

WEBSITE is currently unable to handle this request

HTTP ERROR 500

IIS HTTP Error 500 Display on Chrome browser

What is 500 Internal Server Error

First of all, the 500 Internal Server Error is a very general HTTP status code that indicates something has gone wrong on the web server without any specifics on the exact problem.

This instruction is limited to solving a 500 error on IIS server for classic ASP websites, however some other instructions that’s related to IIS in general will help for troubleshooting IIS server for .NET applications as well.

As 500 Server Error message is very often vague, the task now is to find a more specific error message that will help us further analyze and troubleshoot the issue.

Enable Debugging and Send Errors to Browser

If the website is not in a production environment, the easiest way to do it is to enable the ASP Debugging Properties and send the errors to the browser by following these steps:

  1. Launch Internet Information Services (IIS) Manager and on the left pane, select your ASP website and click on the ASP icon (Configure properties for ASP applications).

    IIS settings to configure properties for ASP applications

  2. Under the ASP window, expand the Debugging Properties and set Enable Client-side Debugging, Enable Server-side Debugging, and Send Errors To Browser to True and click Apply.

    IIS ASP Debugging Properties settings to browser

Now, when you refresh your ASP website, you will see a more descriptive error message on your browser such as the following example:

System.Xml error '80131509'

There is an error in the XML document.

/itnota/failed-page.asp, line 289

ASP 500 Error detailed failed page

With this information, you can right away open the file (e.g., itnota/failed-page.asp) and check line number 289. Again, this option is not recommended for a production website that’s still actively used and available for public since it exposes too much information publicly. The ideal way to do it is to replicate your production environment on a staging and try to reproduce the error on a lower environment.

Check IIS Log

Another way to check 500 Internal Server Error for your ASP website is by viewing IIS error logs. This is especially true if your ASP website is a public website.

Where to find the IIS Logs?

By default, the log for your website is stored on %SystemDrive%\inetpub\logs\LogFile, but you should not use this settings for a production environment. Always set a custom path for your logs so your websites are easier to maintain in the long run. If you have a different physical hard drive for logs, even better. Make sure it’s set to Enabled.

IIS Log properties

For the sake of example, the log files are located in folder D:\Logs\ITNota.com:

From the IIS log example below, the easiest way is to look for a pipe character (“|”) on the date and time when the error happens.

IIS Log 500 Error

The error message can be broken down into two parts:

  1. /itnota/failed-page.asp id=2087216&catId=749272

  2. |289|80131509|There_is_an_error_in_the_XML_document.

The first part indicates the problematic file with its parameters which can be reconstructed by replacing the white space with a question mark (“?”) like so:

  /itnota/failed-page.asp?id=2087216&catId=749272

The second part which starts with a pipe character (“|”) is the line number that caused the error, the error code, and the error description:

  |289|80131509|There_is_an_error_in_the_XML_document.

From the above information, we are looking at the following information:

Item Description
Filename /itnota/failed-page.asp
Line number 289
Error code 80131509
Error description There_is_an_error_in_the_XML_document.

Check the affected file by opening it in Visual Studio Code or any IDE.

If you use Visual Studio Code to read and write ASP or VBScript, click here for a way how to colorize your ASP code.

Probably your web.config file is wrong or is missing some tag. I solved my problem using the correct config tags for .NET 4.

<system.web>
    <compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
        <assemblies>
            <add assembly="System.Deployment, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
            <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
            <add assembly="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
            <add assembly="System.Web.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
            <add assembly="System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Transactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        </assemblies>
    </compilation>
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
        <namespaces>
            <clear/>
            <add namespace="System"/>
            <add namespace="System.Collections"/>
            <add namespace="System.Collections.Specialized"/>
            <add namespace="System.Configuration"/>
            <add namespace="System.Text"/>
            <add namespace="System.Text.RegularExpressions"/>
            <add namespace="System.Web"/>
            <add namespace="System.Web.Caching"/>
            <add namespace="System.Web.SessionState"/>
            <add namespace="System.Web.Security"/>
            <add namespace="System.Web.Profile"/>
            <add namespace="System.Web.UI"/>
            <add namespace="System.Web.UI.WebControls"/>
            <add namespace="System.Web.UI.WebControls.WebParts"/>
            <add namespace="System.Web.UI.HtmlControls"/>
        </namespaces>
    </pages>
    <authentication mode="None"/>
</system.web>

Мы описывали как настраивать веб-публикацию на IIS в инструкции.

Но после настройки веб-публикации при подключении к базе может возникать ошибка “Ошибка HTTP 500.0 — Internal Server Error”.

Если модуль был установлен с 32-битного клиента, то требуется это указать в пуле приложений. Для этого мы делаем следующую настройку:

  • Заходим в Панель управления → Администрирование → Диспетчер служб IIS.
  • Выбираем Пулы приложения которые задействованы в веб-публикации, в нашем случае DefaultAppPool.
  • Нажимаем ПКМ Дополнительные параметры.
  • В строке Разрешены 32-разрядные приложения мы указываем True как на Рисунке 1.
  • Нажимаем ОК.

главная страница

Рисунок 1 — Дополнительные параметры пула приложений

Если не сработало, есть следующие возможные решения:

  1. Убедитесь, что разрешения NTFS для файла web.config верны и обеспечивают доступ к учетной записи компьютера веб-сервера. Заходим в директорию, где размещена публикация (по умолчанию — C:\inetpub\wwwroot\ИМЯ_БАЗЫ). Нажимаем ПКМ на web.config → Свойства → Безопасность. Убедитесь в том, что у группы IIS_USERS есть права на чтение, выполнение, запись и изменение файла. Если нет — нажмите кнопку Изменить, в появившемся окне Добавить → Дополнительно и найдите в списке IIS_USERS. Добавьте эту группу и назначьте соответствующие права.
  2. Проверьте журналы событий, чтобы посмотреть, была ли зафиксирована какая-либо дополнительная информация. Открываем Выполнить (ПКМ на кнопку меню пуск или сочетанием клавиш Win+R), вводим “eventvwr.msc”, нажимаем Enter. Возможно, журнал даст подсказку какой компонент может сбоить.
  3. Переустановите компонент IIS на сервере. В диспетчере серверов удалите роль Веб-сервера IIS, перезагрузите сервер, а затем установите заново через оснастку Добавить роли и компоненты.
  4. Установите компонент расширения .NET, если запрос сопоставлен управляемому обработчику.

В Windows Server 2012 и младше: заходим в Диспетчер серверов → Добавить роли и компоненты → Роли сервера → Веб-сервер (IIS) → Веб-сервер → Разработка приложений → Расширяемость .NET. Далее идём далее по указаниям системы.

После применения настроек, мы можем подключаться к настроенной веб-публикации без ошибок.

Нужна готовая настройка веб-доступа к 1С? Попробуйте наш сервер 1С в аренду, в услугу включены все настройки и обслуживание.

500 internal server error clearly indicates that something went wrong during the display of PHP page.

By default, web servers like IIS return only generic error messages in websites. Often, this causes the masking of real reason for IIS PHP errors such as 500 internal server error.

That’s why, we frequently get request from Windows server owners to find out the reason for PHP website errors and fix them as part of our Server Management Services.

Today, we’ll take a look on how Bobcares’ Engineers track the real reason and fix php 500 internal server error in IIS.

What causes PHP 500 internal server error in IIS

Basically, 500 Internal Server Error is IIS web server’s way of saying, “Something has gone wrong when I tried to display the page. Not sure what.

Now, its time to see the exact reasons for the 500 errors.

1. Permissions Error

From our experience in managing servers, our Windows Experts often see PHP 500 internal server errors due to wrong permissions and ownership on website files. In Windows servers, every file and every folder has its own set of permissions. Again, some permissions are inherited from the parent folders too. And, when the PHP binary do not have enough permissions to execute the scripts, it can result in 500 internal server error.

Similarly, ownership of the files also create problems. In Windows, specific users like IIS User, IIS WP User, etc. should have access on the website folders and files. For example, the IUSR account should have modify permissions on php scripts. And, when there are permission problems, website shows PHP errors.

2. Bad PHP Settings

Yet another reason for PHP internal server error is bad PHP settings. The PHP settings are specified in the configuration file at C:\PHP\PHP.ini. PHP binary take the values from this file while executing scripts.

A classic example will be PHP timeout settings. When the website PHP scripts has to fetch results from external resources, PHP timeout values often cause trouble.  Most system administrators set timeout values in PHP to avoid abuse of the server resources. And, if the PHP script executes for a time longer than the threshold limits, it eventually results in 500 error.

3. PHP module errors

A very few 500 errors happen when the PHP module on the server as such becomes corrupt too. As a result, it results in processing failure of PHP scripts.

Luckily, when the website reports the 500 error due to module failures, IIS often show a more specific error messages like:

500.0 Module or ISAPI error occurred.
500.21 Module not recognized.

How we fixed PHP 500 internal server error in IIS

Fixing PHP 500 internal server error in IIS need a series of steps. Let’s now see how our Dedicated Engineers fixed it for one of our customers and made PHP scripts running.

The customer reported 500 internal server error on WordPress website running in IIS.

1. Turning On Display errors

While the error correctly suggested that PHP had caused 500 error code, it did not provide application-specific information about what caused the error. Therefore, the the first step of investigation was to turn ON display errors option. For this, our Dedicated Engineers followed the steps below.

  1. Using Windows® Explorer, browse to C:\PHP and open the Php.ini file in the PHP installation directory.
  2. Edit and set the display_errors = On directive.
  3. Save the file.
  4. Reset IIS using the command iisreset.exe

After turning on the errors, we reloaded the PHP and it showed a PHP parse error:

Parse error: parse error in C:\inetpub\users\xxx\httpdocs\mysite\error.php on line 3 >>

Often browser settings only show friendly error messages. In such cases, we recommend customer to turn it Off. For example, in Internet Explorer Go to Tools, Internet Options, Advanced tab, and then clear the Show friendly HTTP error messages check box.

Thus, it was a coding error on the PHP script. We suggested script modifications to customer and that fixed the error.

2. Running PHP script locally

Yet another way to find the exact error is to run the problem php script within the server. For this, our Support Engineers connect to the server via rdesktop and execute php script using the php.exe binary. It would show the  DLL’s that are having conflicts and causing the 500 error. We fix these conflicts and make the script working again.

3. Correcting PHP settings

In some cases, we need to correct the PHP settings to get the problem solved. Recently, when a customer reported problems with his website, we had to set the php directive open_basedir correctly to solve 500 Internal Server Error.

Similarly, when PHP cgi scripts show up some warning, IIS7 still displays an HTTP 500 error message. Although the best method is to fix the PHP scripts, often changing the default error handling for FastCGI in IIS7 to “IgnoreAndReturn200” also work as a temporary fix. The exact settings will look as shown.

4. Fixing PHP binary

In some rare cases, the fix may involve complete rebuilding of PHP binary on the server. This happens mainly when the PHP program on the server becomes corrupt. However, in such cases our Dedicated Engineers always check the dependency of the package and do the reinstall. For control panel specific servers, we set the appropriate binary on the server.

[Broken PHP scripts causing big problems? Our IIS experts have the fix for you.]

Conclusion

In a nutshell, PHP 500 internal server error in IIS happens mainly due to reasons like buggy PHP scripts, wrong server settings and many more. Today, we saw the top reasons for the error and how our Support Engineers fix it for customers.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = «owonCMyG5nEQ0aD71QM»;

Понравилась статья? Поделить с друзьями:
  • Illegal use of floating point c ошибка
  • Importrange ошибка загрузка данных
  • Igkmd64 sys ошибка
  • Illegal string offset php ошибка
  • Importrange google таблицы внутренняя ошибка при импорте диапазона