WCF错误| IIS 7.5 | 500.24

WCF错误| IIS 7.5 | 500.24,wcf,iis-7,wcf-binding,wcf-security,wcf-client,Wcf,Iis 7,Wcf Binding,Wcf Security,Wcf Client,我的机器上运行了一个WCF服务,在调试模式下运行VisualStudio2008时启动该服务。在我尝试将新网站添加到IIS 7.5之前,一切都很正常。现在,当我在调试模式下启动我的客户机时,我收到以下错误 The content type text/html; charset=utf-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8). If usin

我的机器上运行了一个WCF服务,在调试模式下运行VisualStudio2008时启动该服务。在我尝试将新网站添加到IIS 7.5之前,一切都很正常。现在,当我在调试模式下启动我的客户机时,我收到以下错误

The content type text/html; charset=utf-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<title>IIS 7.5 Detailed Error - 500.24 - Internal Server Error</title> 
<style type="text/css"> 
<!-- 
body{margin:0;font-size:.7em;font-family:Verdana,Arial,Helvetica,sans-serif;background:#CBE1EF;} 
code{margin:0;color:#006600;font-size:1.1em;font-weight:bold;} 
.config_source code{font-size:.8em;color:#000000;} 
pre{margin:0;font-size:1.4em;word-wrap:break-word;} 
ul,ol{margin:10px 0 10px 40px;} 
ul.first,ol.first{margin-top:5px;} 
fieldset{padding:0 15px 10px 15px;} 
.summary-container fieldset{padding-bottom:5px;margin-top:4px;} 
legend.no-expand-all{padding:2px 15px 4px 10px;margin:0 0 0 -12px;} 
legend{color:#333333;padding:4px 15px 4px 10px;margin:4px 0 8px -12px;_margin-top:0px; 
 border-top:1px solid #EDEDED;border-left:1px solid #EDEDED;border-right:1px solid #969696; 
 border-bottom:1px solid #969696;background:#E7ECF0;font-weight:bold;'.
内容类型text/html;响应消息的charset=utf-8与绑定的内容类型(text/xml;charset=utf-8)不匹配。如果使用自定义编码器,请确保正确实现IsContentTypeSupported方法。响应的前1024个字节是:'
IIS 7.5详细错误-500.24-内部服务器错误

我只是在工作中遇到了一个与此相关的bug(实际上得到的是相同的输出)。问题是应用程序在集成模式下运行时启用了模拟。为了修复此问题,我将以下内容添加到该服务的web.config中:

<configuration>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
  </system.webServer>
</configuration>

这将绕过集成模式验证,该验证将检查“和节以及模拟”


请按照以下步骤操作:

  • 首先,确保WCF已在IIS和ASP.NET(确切版本)中正确注册。 如需有关如何使用的详细信息

  • 其次,打开IIS并转到网站/虚拟目录的高级设置。在“高级设置”弹出窗口中,将应用程序池更改为“Classic.NET AppPool”,然后单击“确定”

  • 需要记住的重要一点是,我们的应用程序正在使用的应用程序池应该有两个重要的设置。 a) AppPool的托管管道模式应设置为“经典”,而不是“集成”。 b) AppPool的.NET Framework版本应与我们用于WCF服务的版本相同

    有了这两个设置,我们就可以为我们的应用程序创建和使用一个新的应用程序池,而不需要特定于“Classic.NET AppPool”

    <configuration>
      <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
      </system.webServer>
    </configuration>