我有一个简单的webAPI构建Visual Studio 2013。当我从VS13运行它时,它工作得很好,但当我在本地IIS中复制项目时,它给了我以下错误。

HTTP错误500.19 -内部服务器错误不能被请求的页面 访问,因为该页的相关配置数据为 无效的。

详细错误信息:

模块IIS Web核心

通知BeginRequest

处理人尚未确定

错误码0x80070021

配置错误该配置项不能在该路径下使用。当section被锁定在父级时,就会发生这种情况。锁定是默认的(overrideModeDefault="Deny"),或者由overrideMode="Deny"或遗留的allowOverride="false"的位置标记显式设置。

配置文件\?\C:\inetpub\wwwroot\APITeslin\web.config

配置来源:

36:   <system.webServer>  
37:     <handlers>  
38:       <remove name="ExtensionlessUrlHandler-Integrated-4.0" />

当前回答

检查IIS服务器是否安装了URL重写功能。 如果没有安装,请确保您的web。配置文件没有URL重写相关配置

<!-- Make sure don't have below config, if server have not installed url rewrite feature. -->
<rewrite>
  <rules>
    <rule name="Fail bad requests">
      <match url=".*"/> ...

有时我们从旧服务器复制配置,然后直接部署到全新的服务器,然后我们可能会遇到这样的500问题。

其他回答

我也遇到了同样的问题,但在与IIS和谷歌头脑风暴了好几个小时后。我找到解决办法了。 此错误是因为在IIS applicationHost.config中禁用了某些设置。

以下是解决方案的步骤:

打开C:\Windows\System32\inetsrv\config\applicationHost。配置并在记事本打开 中显示的下列键值 <section name="handlers" overrideModeDefault="Deny" />将此值从"Deny"更改为"Allow" <section name="modules" allowDefinition="MachineToApplication" overrideModeDefault="Deny" /> 将此值从“Deny”更改为“Allow”

这对我很管用。

你的网络。config描述了您正在使用表单身份验证-确保您在IIS的身份验证菜单下启用了表单身份验证并禁用了IIS中的匿名身份验证,对于在IIS中运行的网站。

在Windows 8.1和iis8.5上,我的解决方案是从控制面板注册4.5:

程序和功能>打开或关闭Windows功能>信息信息服务>万维网服务>应用程序开发功能>选择ASP。NET 4.5

单击OK。

得到了完全相同的错误,然后得到了这个问题。正如@SpaceBison在评论中提到的,这个答案描述了解决方案- https://stackoverflow.com/a/12867753/404099。我发现得太晚了,它漏了几步。这对我来说很管用:

Windows Server 2012, IIS 8.5。应该也适用于其他版本。

Go to server manager, click add roles and features In the roles section choose: Web Server Under Security sub-section choose everything (I excluded digest, IP restrictions and URL authorization as we don't use them) Under Application Development choose .NET Extensibility 4.5, ASP.NET 4.5 and both ISAPI entries In the features section choose: NET 3.5, .NET 4.5, ASP.NET 4.5 In the web server section choose: Web Server (all), Management Tools (IIS Management Console and Management Service), Windows Authentication - if you are using any of it

检查IIS服务器是否安装了URL重写功能。 如果没有安装,请确保您的web。配置文件没有URL重写相关配置

<!-- Make sure don't have below config, if server have not installed url rewrite feature. -->
<rewrite>
  <rules>
    <rule name="Fail bad requests">
      <match url=".*"/> ...

有时我们从旧服务器复制配置,然后直接部署到全新的服务器,然后我们可能会遇到这样的500问题。