WCF错误| IIS 7.5 | 500.24

时间:2011-04-28 00:51:03

标签: wcf iis-7 wcf-binding wcf-security wcf-client

我的机器上运行了一个WCF服务,当我在调试模式下运行visual studio 2008时,它会被激活。在我尝试将新网站添加到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;'.

我不确定是什么导致这种情况,请你帮帮我吗?

以下是我的IIS 7.5配置.. 匿名身份验证=已启用 ASP.NET模拟:已启用 基本身份验证:已启用 表单身份验证:已启用 Windows身份验证:已启用

我正在从我的客户端配置文件中引用我的web服务,如下所示。 http://localhost:2336/Service.svc

请注意,此服务是我的项目的一部分,并未显式添加到IIS。当我的客户端以调试模式运行时,它会自动启动,而在web.config文件中,身份验证设置为

 <authentication mode="None"/>

此外,我怀疑在安装Skype后这种情况开始发生,这与此有什么关系吗?

谢谢, -Mike

2 个答案:

答案 0 :(得分:3)

我刚刚在工作中遇到了一个涉及此问题的错误(实际上得到了相同的输出)。问题是在应用程序以集成模式运行时启用了模拟。为了解决这个问题,我在服务的web.config中添加了以下内容:

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

这将绕过集成模式验证,它会检查“&lt; system.Web / httpHandlers&gt;和&lt; system.Web / httpModules&gt;部分以及模拟”source

More info that helped me

答案 1 :(得分:0)

请按照以下步骤操作:

  1. 首先,确保使用IIS和ASP.NET(确切版本)正确注册WCF。 有关如何register WCF with IIS and ASP.NET

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

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

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

相关问题