2011-04-28 97 views
1

我有一臺WCF服務在我的機器上運行,當我在調試模式下運行我的visual studio 2008時,這個服務被激活。一切工作正常,直到我試圖添加一個新的網站到我的IIS 7.5。現在,當我以調試模式啓動客戶端時,我收到以下錯誤消息。WCF錯誤| IIS 7.5 | 500.24

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模擬:啓用 基本身份驗證:啓用 Forms身份驗證:啓用 Windows身份驗證:啓用

我引用我的web服務從我的客戶端配置文件如下。 http://localhost:2336/Service.svc

請注意,此服務是我的項目的一部分,並沒有明確添加到IIS。當我的客戶在調試模式下運行,並在web.config文件中爲

<authentication mode="None"/> 

而且我懷疑,這開始發生了身份驗證設置即可自動啓動後,我安裝的Skype,意志有什麼與此?

感謝, -Mike

回答

0

請按照下面的步驟爲:

  1. 首先,確保WCF使用IIS和ASP.NET(確切版本)正確註冊。 有關如何register WCF with IIS and ASP.NET的詳細信息。

  2. 其次,打開IIS並轉到您的網站/虛擬目錄的高級設置。在「高級設置」彈出窗口中,將應用程序池更改爲「Classic .NET AppPool」,然後單擊確定。

要記住的重要一點是我們應用程序使用的應用程序池應該有兩個重要的設置。 a)AppPool的管理管道模式應該設置爲「Classic」而不是「Integrated」。 b)AppPool的.NET Framework版本應與我們用於WCF服務的版本相同。

有了這兩個設置,我們可以爲我們的應用程序創建和使用新的AppPool,我們不需要特定於「Classic .NET AppPool」。

3

我只是在工作中涉及此錯誤(字面上得到同樣的輸出)。問題是當應用程序在集成模式下運行時啓用了模擬。要修正,添加以下到web.config爲服務:

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

這將繞過集成模式驗證,檢查「<的System.Web/HttpHandlers的>和<的System.Web /的HttpModules >部分作爲還有冒充」 source

More info that helped me