Reputation: 33
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!
Upvotes: 1
Views: 8674
Reputation: 1038
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):
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>
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
Upvotes: 5
Reputation: 1162
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?
Upvotes: 0