2009-01-23 211 views
5

更新3:
我創建了一個Visual Studio 2008的測試項目,並試圖建立一個服務引用共享網站WCF服務引用並收到以下錯誤:負載均衡錯誤 - NLB

There was an error downloading ' http://apps.mydomain/MyService.svc '. The request failed with HTTP status 400: Bad Request. Metadata contains a reference that cannot be resolved: ' http://apps.mydomain/MyService.svc '. Content Type application/soap+xml; charset=utf-8 was not supported by service http://apps.mydomain/MyService.svc '. The client and service bindings may be mismatched. The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'.. If the service is defined in the current solution, try building the solution and adding the service reference again.

更新2:
@Nick - 我試着用每個服務器的全限定路徑明確地設置每個端點的地址,我仍然得到相同的結果。

此外,當我嘗試使用共享站點URL設置listenUri屬性時,出現400錯誤請求錯誤,而不是404錯誤。

UPDATE
經過一些額外的研究,也有一些IIS配置http://apps1.mydomainhttp://apps2.mydomain之間設置衝突,並能闖過「服務器應用程序不可用」錯誤。

現在,當我嘗試瀏覽到共享網站(http://apps.mydomain)時,出現404錯誤,但我可以瀏覽到http://apps1.mydomainhttp://apps2.mydomain服務參考。

原來的問題

我公司的使用Microsoft NLB載入我們的IIS服務器之間平衡流量。我最近在每個IIS 6 Windows Server 2003 Standard Edition SP1服務器上部署了一個WCF服務。我收到以下錯誤,當我試圖瀏覽使用IE 7共享域名:

Server Application Unavailable The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser to retry your request.

Administrator Note: An error message detailing the cause of this specific request failure can be found in the application event log of the web server. Please review this log entry to discover what caused this error to occur.

消費者將指向http://apps.mydomain使用的服務,但虛擬域被映射到http://apps1.mydomainhttp://apps2.mydomain。如果我瀏覽到每臺服務器上的服務,我不會收到該錯誤。

該服務當前正在使用匿名basicHttpBinding。

是否有其他人遇到過這個問題?

歷史

在此之前的錯誤開始發生,我當我broswed所有三個域名(http://apps.mydomainhttp://apps1.mydomainhttp://apps2.mydomain)收到以下錯誤:我用ServiceHostFactory

This collection already contains an address with scheme http. There can be at most one address per scheme in this collection.

類來定製我的.svc文件以指定一個定製服務工廠。然後,我通過從ServiceHostFactory繼承並根據需要重寫來創建自定義工廠。

public class MyFactory : ServiceHostFactory 
{ 
    protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses) 
    { 
     return new ServiceHost(serviceType, baseAddresses[0]); 
    } 
} 

<%@ ServiceHost Language="C#" Factory="MyFactory" Debug="true" Service="MyService" CodeBehind="~/App_Code/MyService.cs" %> 

回答

2

經過對我的WCF服務和使用應用程序的不同配置做了一些嘗試之後。我在消費應用程序中爲其中一個工作服務參考(http://apps1.mydomainhttp://apps2.mydomain)創建了服務參考。然後,我將客戶端配置中的端點引用更改爲指向共享站點WCF地址(http://apps.mydomain),並且我能夠使用和使用該服務。

1

我與WCF和負載均衡,其中服務器曾與不同的IP地址和WCF多個網卡只想PIC它找到的第一個IP地址之前已經有一個問題。我們必須在每個服務器的服務定義上明確設置IP地址,以便WCF將綁定到正確的IP地址。

+0

@Nick - 你能否提供一個例子或提供資源? – 2009-01-28 18:42:20