You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

IIS 10迁移网站后出现HTTP Error 500.19内部服务器错误求助

问题描述

我更换了网站服务器,新服务器搭载Windows Server 2016 R2系统并使用IIS 10。将旧服务器的文件迁移至新服务器后,添加网站并绑定80端口,现在访问网站时出现以下错误:

HTTP Error 500.19 - Internal Server Error
请求的页面无法访问,因为该页面的相关配置数据无效。

对应的web.config片段(存在截断):

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
<configSections> 
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> 
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 
<section name="TravelEnterProject.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> 
</sectionGroup> 
</configSections> 
<connectionStrings> 
<add name="DefaultConnection" connectionString="Data Source=.;Initial Catalog=TravelEnterDB;User ID=User;Password=rLyVhrghj#A39Ac" providerName="System.Data.SqlClient" /> 
<add name="TravelEnterDBEntities" connectionString="metadata=res://*/AdakDbModel.csdl|res://*/AdakDbModel.ssdl|res://*/AdakDbModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.;initial catalog=TravelEnterDB;persist security info=True;user id=User;password=rLyVhrdfffd@j#A39Ac;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /> 
<add name="TravelEnterDBEntities2" connectionString="metadata=res://*/Models.DbModel.TravelEnterModels.csdl|res://*/Models.DbModel.TravelEnterModels.ssdl|res://*/Models.DbModel.TravelEnterModels.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.;initial catalog=TravelEnterDB;user id=User;password=rLyVhr9dfdf39Ac;multipleactiveresultsets=True;application name=EntityFramework&quot;" providerName="System.Data.EntityClient" /> 
</connectionStrings> 
<appSettings> 
<add key="webpages:Version" value="3.0.0.0" /> 
<add key="webpages:Enabled" value="false" /> 
<add key="ClientValidationEnabled" value="true" /> 
<add key="UnobtrusiveJavaScriptEnabled" value="true" /> 
<add key="fullsize" value="/uploadimage/UploadImages/" /> 
<add key="Image900x500" value="/uploadimage/UploadImages/900x500/" /> 
<add key="Image270x160" value="/uploadimage/UploadImages/270x160/" /> 
<add key="Image70x70" value="/uploadimage/UploadImages/70x70/" /> 
<add key="Sitekey" value="6LfbRCwUAAAAANSNLUZvBUMmn6Nzc-q" /> 
<add key="Secretkey" value="6LfbRCwUAAAAAKDeRsyy7vcupQME1wO" /> 
</appSettings> 
<system.web> 
<authentication mode="None" /> 
<compilation debug="false" targetFramework="4.5" /> 
<httpRuntime targetFramework="4.5" /> 
<httpCookies requireSSL="true" /> 
<customErrors mode="on" /> 
</system.web> 
<system.webServer> 
<stripHeaders> 
<header name="Server" /> 
<header name="X-Powered-By" /> 
<header name="X-Aspnet-Version" /> 
</stripHeaders> 
<httpProtocol> 
<customHeaders> 
<remove name="X-Powered-By" /> 
<add name="X-Frame-Options" value="SAMEORIGIN" /> 
<add name="Access-Control-Allow-Origin" value="*" /> 
</customHeaders> 
</httpProtocol> 
<validation validateIntegratedModeConfiguration="false" /> 
<modules> 
</modules> 
<rewrite> 
<rules> 
<rule name="Redirect to HTTPS" stopProcessing="true"> 
<match url="(.*)" /> 
<conditions> 
<add input="{HTTPS}" pattern="^OFF$" /> 
</conditions> 
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" /> 
</rule> 
<rule name="charter" enabled="false"> 
<match url="^charter/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/(.*)" /> 
<action type="Rewrite" url="Charter?depCountryId={R:1}&amp;DepCityId={R:2}&amp;ArrCountryI"

排查与解决步骤

Hey there, let's work through this HTTP 500.19 error together—this is almost always tied to invalid configuration or missing IIS components, so let's start with the most obvious fixes:

1. Fix the Truncated web.config

Looking at the provided web.config snippet, the last rewrite rule (name="charter") is incomplete—it cuts off mid-action URL:

<action type="Rewrite" url="Charter?depCountryId={R:1}&amp;DepCityId={R:2}&amp;ArrCountryI"

This will definitely cause IIS to throw a configuration parsing error. You have two options here:

  • If you don't use this rule, delete the entire <rule name="charter" ...> block (make sure to remove all opening/closing tags properly)
  • If you need this rule, restore the full, valid configuration for it (complete the URL and add the closing </action>, </rule> tags)

2. Verify Required IIS Features Are Installed

Since your site targets ASP.NET 4.5, ensure these components are installed on your Windows Server 2016 R2:

  • Open Server Manager → Add Roles and Features
  • Under Web Server (IIS) → Application Development, check:
    • ASP.NET 4.5
    • .NET Extensibility 4.5
  • Under Web Server (IIS) → Security, check Request Filtering
  • Also, since your config uses <rewrite> rules, you need the URL Rewrite Module installed (you can get this via the IIS Web Platform Installer or directly from the Microsoft Download Center)

3. Check File/Folder Permissions

IIS needs proper access to your site files:

  • Right-click your website root folder → Properties → Security
  • Add the IIS application pool identity (default is IIS AppPool\[YourAppPoolName])
  • Grant this user Read & Execute permissions on the root folder, and Read/Write permissions on the uploadimage directory (since your config references image upload paths)

4. Validate Connection Strings (Post-Config Fix)

Once you resolve the config error, you might hit database connection issues. Double-check:

  • The SQL Server service is running on the new server (since your connection strings use Data Source=.; for local SQL)
  • The username/password in your connection strings are correct (note: you have three different connection strings with different passwords—confirm which one your application actually uses)
  • Ensure the TravelEnterDB database exists on the local SQL instance

5. Check Application Pool Mode Compatibility

Your config has <validation validateIntegratedModeConfiguration="false" />, which disables checks for integrated mode conflicts. If you're still having issues after the above steps:

  • Try switching your application pool's Managed Pipeline Mode to Classic (in IIS Manager, go to Application Pools → select your pool → Advanced Settings)
  • Or, if you prefer integrated mode, verify that all modules referenced in your config are properly registered in IIS

内容的提问来源于stack exchange,提问作者hmahdavi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 09:34:46