wcf - WCF 服务负载平衡错误 - NLB

标签 wcf iis-6 windows-server-2003 load-balancing nlb

更新 3:
我创建了一个 Visual Studio 2008 测试项目并尝试创建对共享站点 WCF 服务引用的服务引用并收到以下错误:

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 bad request 错误而不是 404 错误。

更新
经过一些额外的研究,在 http://apps1.mydomain 之间存在一些 IIS 配置设置冲突。和 http://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。

有没有其他人遇到过这个问题?

历史

在此错误开始发生之前,我在浏览所有三个域名( http://apps.mydomainhttp://apps1.mydomainhttp://apps2.mydomain )时收到以下错误:

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



我用了 ServiceHostFactory类来自定义我的 .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" %>

最佳答案

在为我的 WCF 服务和消费应用程序尝试了不同的配置之后。我在消费应用程序中创建了对工作服务引用之一( http://apps1.mydomainhttp://apps2.mydomain )的服务引用。然后我将客户端配置中的端点引用更改为指向共享站点 WCF 地址 ( http://apps.mydomain ),并且我能够消费和使用该服务。

关于wcf - WCF 服务负载平衡错误 - NLB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/475076/

相关文章:

iis - 如何使用命令行在 IIS 中创建应用程序?

c# - 在 WCF 的添加服务引用中找不到 net.tcp 端点?

asp.net - Web.config 转换和发布

asp.net - 当我编辑 web.config 时会发生什么?

automation - Windows 服务器上的任务自动化软件

c++ - Windows 服务启动进程结束通知(2003、2008)

mysql - 从亚马逊ubuntu 10.04实例连接到Windows Server 2003中的Oracle数据库

c# - 有时添加 WCF 服务引用会生成一个空的 reference.cs

.net - .NET 1.1和.NET 3.5之间的“Best”通信方式

c# - 具有工作线程的 WCF 服务?