问题描述
我有一个网站,我知道有一个有效的web.config文件的本地副本,它运行在生产,在Visual Studio 2013年它在.NET版本4.0上运行。我越来越可怕的HTTP错误500.19 - 内部服务器错误。有一个在错误页面的配置源部分怪异的信息:
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:
配置源
-1:
0:的
-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.
谢谢!
推荐答案
有此错误的许多来源 - 我似乎击中其中大部分:((
There are many sources of this error – I seem to have hit most of them :((
这适用于赢得Server 2008 R2的64位SP1和放大器; IIS 7.5。
This applies to Win Server 2008 R2 64 bit SP1 & IIS 7.5.
.NET版本的web应用程序与放大器之间的不同;分配的应用程序池
一般情况下,在web-app .NET版本在Web.config文件中指定
Generally, the web-app .NET version is specified in the Web.config file
...
<system.web>
<httpRuntime targetFramework="4.5" />
<compilation targetFramework="4.5.2" />
...
分配给该应用程序的应用程序池的.NET版本必须是兼容的。
The .NET version of the app-pool assigned to this application must be compatible
要获得分配给一个web应用程序的应用程序池
To get the app-pool that is assigned to a web-app
IIS Manager > [web-app] > Basic Settings > Application Pool
要设置应用程序池的.NET版本
To set the .NET version of the app-pool
IIS Manager > Application Pools > [app-pool-name] > Basic Settings > .NET Framework Version
一般情况下,只有两种选择.NET 2.0.50727和.NET 4.0.30319
Generally, there are only two choices .NET 2.0.50727 and .NET 4.0.30319
我们已经安装了.NET 4.6.1 - (4.6.01055),但在IIS中,只有以上的版本显示
We have installed .NET 4.6.1 - (4.6.01055) but in IIS, only the above versions are shown.
web-app的物理路径设置为一个映射文件夹
与web应用相关联的物理路径必须是一个UNC路径 - 而不是映射路径
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
这个作品:
\\[server-name]\share
这将失败:
M:\share
原因是,映射网络驱动器只能在你的会话中,而不是运行IIS的会话。
The reason is that mapped network drives only exist in your session, not the session that IIS is running.
web-app的物理路径的访问权限
用户帐户中的应用程序池设置必须访问Web应用物理路径足够的访问权限。
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具有可用于所有应用程序,池内置的虚拟账户ApplicationPoolIdentity。当此内置帐户与应用程序池关联,IIS创建一个新的独特的用户帐户为应用程序池。
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.
如果使用此默认帐户的机制,使用这种格式通过Windows资源管理器,然后在IIS服务器上的相关帐户必须给予权限:
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>
请注意IIS服务器(其中应用程序池所在)必须选择位置......在上面的格式(不区分大小写)的应用程序池的名称。
当您单击检查名称,那么唯一的应用程序池的帐户将被解决,然后可以分配正确的权限。
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.
而不是使用IIS内置帐户,另一种选择是在一个专门的服务帐户运行的应用程序池。使用服务帐户意味着,密码不会过期(除其他事项外)。
服务帐户必须被赋予在根文件夹上的权限。
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.
应用程序池帐户密码已更改/过期
有关应用程序池的用户帐户,如果密码已更改或过期,则需要在IIS中明确更新了密码
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
如果你使用内置的虚拟账户ApplicationPoolIdentity的IIS这并不适用 - 创建的帐户没有密码。另一个原因使用IIS虚拟账户机制。
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重写模块没有安装
如果在web-app使用重写规则,必须安装URL重写模块
If the web-app uses rewrite rules, the URL rewrite module must be installed
重写规则可以在Web.config文件中指定
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>
...
在IIS中未注册ASP.NET
根据在IIS和订单上的.NET 4的安装/升级,可能有必要与IIS重新注册ASP.NET。
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
这应该给像
...
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
下面,.NET 2注册了64位应用程序和.NET 4被注册为32安培; 64位应用程序。
Here, .NET 2 is registered for 64 bit apps and .NET 4 is registered for both 32 & 64 bit apps.
如果您的目标框架和放大器; 32/64位配置不在列表:
If your target framework & 32/64 bit config is not in the list:
aspnet_regiis -i
这篇关于HTTP错误500.19 - 内部服务器错误IIS 7.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!