WCF服务的负载平衡错误-NLB [英] Load balancing error with WCF service - NLB

查看:125
本文介绍了WCF服务的负载平衡错误-NLB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

UPDATE 3:
I created a Visual Studio 2008 test project and tried to create a service reference to shared site WCF service reference and received the following error:

下载时出错 " http://apps.mydomain/MyService.svc ". 请求失败,HTTP状态 400:错误的请求.元数据包含一个 无法解析的参考: " http://apps.mydomain/MyService.svc ". 内容类型application/soap + xml; charset = utf-8不被支持 服务 http://apps.mydomain/MyService.svc ". 客户端和服务绑定可能是 不匹配.远程服务器返回 错误:(415)无法处理 消息,因为内容类型 'application/soap + xml; charset = utf-8' 不是预期的类型'text/xml; charset = utf-8'.如果服务是 在当前解决方案中定义,请尝试 建立解决方案并添加 再次提供服务参考.

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-我尝试了您的建议,即使用每个服务器的标准路径明确设置每个端点的地址,但我仍然得到相同的结果.

UPDATE 2:
@Nick - I tried your suggestion of explictly setting the address of each endpoint with the fully qualified path of each server and I still get the same result.

此外,当我尝试使用共享站点URL设置listenUri属性时,我收到400错误的请求错误,而不是404错误.

Also, when I try to set the listenUri attribute with the shared site URL, I get a 400 bad request error instead of a 404 error.

更新
经过一些额外的研究,在 http://apps1.mydomain

UPDATE
After some additional research, there were some IIS configuration setting conflicts between http://apps1.mydomain and http://apps2.mydomain and was able to get past the "Server Application Unavailable" error.

现在,当我尝试浏览共享站点时,出现了404错误( http://apps.mydomain ),但我能够浏览到 http://apps1.mydomain

Now I am getting a 404 error when I tried to browse to the shared site (http://apps.mydomain), but I am able to browse to the http://apps1.mydomain and http://apps2.mydomain service reference.

原始问题

我的公司使用 Microsoft NLB 来平衡我们之间的流量IIS服务器.我最近将WCF服务部署到了每台IIS 6 Windows Server 2003 Standard Edition SP1服务器上.当我尝试使用IE 7浏览到共享域名时收到以下错误:

My companys uses Microsoft NLB to load balance traffic between our IIS servers. I recently deployed a WCF service on to each IIS 6 Windows Server 2003 Standard Edition SP1 servers. I received the following error when I tried to browse to the shared domain name using IE 7:

服务器应用程序不可用 您尝试的Web应用程序 当前正在此Web服务器上访问 不可用.请点击刷新" Web浏览器中的按钮重试 你的申请.

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.

管理员注意:错误消息 详细说明造成这种情况的原因 请求失败可以在 Web应用程序事件日志 服务器.请查看此日志条目 发现导致此错误的原因 发生.

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.mydomain

The consumer will point to the http://apps.mydomain to use the service but virtual domain is mapped to http://apps1.mydomain or http://apps2.mydomain. If I browse to the service on each server, I do not receive that error.

该服务当前正在使用匿名basicHttpBinding.

The service is currently using a anonymous basicHttpBinding.

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

Has anyone else experienced this issue?

历史

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

Before this error started occurring, I received the following error when I broswed to all three domain name (http://apps.mydomain, http://apps1.mydomain, http://apps2.mydomain):

此收藏集已包含一个 方案http的地址.可以 每个方案中最多只能有一个地址 这个集合.

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

我使用了 ServiceHostFactory 类自定义我的.svc文件以指定自定义服务工厂.然后,我通过继承ServiceHostFactory并根据需要进行覆盖来创建我们的自定义工厂.

I used the ServiceHostFactory class to customize my .svc file to specify a custom service factory. Then I create our custom factory by inheriting from ServiceHostFactory and overriding as required.

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.mydomain http://apps2.mydomain ).然后,我将客户端配置中的终结点引用更改为指向共享站点WCF地址( http://apps.mydomain ),便可以使用和使用该服务.

After some experimenting with different configurations for my WCF service and consuming application. I created a service reference to one of the working service references (http://apps1.mydomain or http://apps2.mydomain) in the consuming application. Then I changed the endpoint reference in the client configuration to point to the shared site WCF address (http://apps.mydomain) and I was able to consume and use the service.

这篇关于WCF服务的负载平衡错误-NLB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆