gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 21:01:09 25 4
gpt4 key购买 nike

更新 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com