1

I have a local copy of a web site that I know has a valid web.config file, it runs in production and in VIsual Studio 2013. It is running on .net version 4.0. I am getting the dreaded "HTTP Error 500.19 - Internal Server Error". There is weird info in the config source section of the error page:

Config Source

-1: 0:

Anyone ever see this one before and have any ideas how to resolve it? App Pool is set correctly and I checked permissions on the folder and added Everyone with full rights.

Thanks!

chromeOne7
  • 33
  • 2
  • 8
  • could it be that you are using IIS Express on your local machine while using IIS in production? – ZuoLi Nov 11 '14 at 19:53
  • I don't think that should matter, I have another site running locally that works in IIS 7.5 – chromeOne7 Nov 11 '14 at 19:57
  • Is this the production site, or are you running it from visual studio using your localhost? – mgrenier Nov 11 '14 at 20:01
  • The web.config file maybe read only...you may want to check that...this error is telling you it can't access the web.config file – mgrenier Nov 11 '14 at 20:09
  • Yeah I already did that and the same error is occurring.. – chromeOne7 Nov 11 '14 at 20:18
  • I am publishing it to my local IIS server from Visual Studio where it runs successfully. – chromeOne7 Nov 11 '14 at 20:19
  • So it's running successfully now? Or are you getting this 500.19, because I wouldn't say getting a 500.19 error constitutes "running successfully" – mgrenier Nov 11 '14 at 20:30
  • With so little information it is difficult to diagnose what your issue is but it seems to be something related to accessing your web.config file. Any additional information would help. – mgrenier Nov 11 '14 at 20:35
  • Yeah that is what I think too, I have checked the permissions on the folder, I even created a folder and moved it there but no luck. I do see that everytime I uncheck Read-Only it reverts back to the setting and it's greyed out. – chromeOne7 Nov 11 '14 at 21:21
  • Have a look at my answer on http://stackoverflow.com/questions/5091640/http-error-500-19-internal-server-error/29032247#29032247. Hope this helps... – Murat Yıldız Mar 13 '15 at 13:23

2 Answers2

5

There are many sources of this error – I seem to have hit most of them :((

This applies to Win Server 2008 R2 64 bit SP1 & IIS 7.5.

.NET version different between Web-App & assigned Application Pool

Generally, the web-app .NET version is specified in the Web.config file

...
<system.web>
  <httpRuntime targetFramework="4.5" />
  <compilation targetFramework="4.5.2" />
...

The .NET version of the app-pool assigned to this application must be compatible

To get the app-pool that is assigned to a web-app

IIS Manager > [web-app] > Basic Settings > Application Pool

To set the .NET version of the app-pool

IIS Manager > Application Pools > [app-pool-name] > Basic Settings > .NET Framework Version

Generally, there are only two choices .NET 2.0.50727 and .NET 4.0.30319

We have installed .NET 4.6.1 - (4.6.01055) but in IIS, only the above versions are shown.

Web-App Physical Path set to a Mapped Folder

The physical path associated with the web-app must be a UNC path - not a mapped path.

IIS Manager > [web-app] > Basic Settings > Physical Path

this works:

\\[server-name]\share

this fails:

M:\share

The reason is that mapped network drives only exist in your session, not the session that IIS is running.

Web-App Physical Path Access Rights

The user-account set in the app-pool must have sufficient access rights to access the web-app physical path.

This user-account must be given these permissions (with inherited rights for sub-folders):

  • Modify
  • Read & Execute
  • List Folder Contents
  • Read
  • Write

IIS 7.5 has a built-in virtual account ‘ApplicationPoolIdentity’ that can be used for all app-pools. When this built-in account is associated with an app-pool, IIS creates a new unique user-account for that app-pool.

If this default account mechanism is used, then the associated account on the IIS server must be given permissions via Windows Explorer using this format:

IIS AppPool\<app-pool-name>

enter image description here

Note that the IIS server (where the app-pool resides) must be selected in 'Locations...' with the app-pool name in the above format (case-insensitive). When you click 'Check Names', the unique app-pool account will then be resolved and can then be assigned the correct permissions.

Because each app-pool must have a unique name, the associated account is also unique.

Rather than use the IIS built-in accounts, another option is to run the app-pool under a dedicated service account. Using a service account means that the password does not expire (among other things). The service account must be given the above permissions on the root folder.

A normal user account can also be used but this is not recommended because of password expiry and the associated access rights need to be carefully set.

App-Pool Account Password Changed/Expired

For the app-pool user-account, if this password has changed or expired, you need to explicitly updated the password in IIS

IIS Manager > Application Pools > [app-pool-name] > Advanced Settings > Process Model > Identity

This does not apply if you use the IIS built-in virtual account ‘ApplicationPoolIdentity’ - the created account does not have a password. Another reason to use the IIS virtual account mechanism.

URL Rewrite Module not installed

If the web-app uses rewrite rules, the URL rewrite module must be installed

Rewrite rules may be specified in the Web.config file

...
<rewrite>
  <rules>
    <rule name="Timesheets Index Rewrite" stopProcessing="true">
      <match url="Timesheets/Index" ignoreCase="true" />
      <action type="Redirect" redirectType="Permanent" url="Timesheets/Entries" />
    </rule>
...

ASP.NET not registered in IIS

Depending on the order in which IIS and .NET 4 are installed / updated, it may be necessary to re-register ASP.NET with IIS.

To check, in a command prompt:

cd C:\Windows\Microsoft.NET\Framework64\v4.0.30319

aspnet_regiis -lv

This should give something like

...
2.0.50727.0             C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll
4.0.30319.0             C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll
4.0.30319.0             C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll

Here, .NET 2 is registered for 64 bit apps and .NET 4 is registered for both 32 & 64 bit apps.

If your target framework & 32/64 bit config is not in the list:

aspnet_regiis -i
Kevin Swann
  • 1,018
  • 12
  • 28
0

make sure your appPool is set to "Integrated"

look at here the diferences between modes:

What is the difference between 'classic' and 'integrated' pipeline mode in IIS7?

Community
  • 1
  • 1
lem2802
  • 1,152
  • 7
  • 18