gpt4 book ai didi

wcf - 生成的元数据 (WSDL) 中的 .net 4 WCF 端点指向节点而不是托管在负载平衡 (NLBS) IIS6 上的虚拟主机

转载 作者:行者123 更新时间:2023-12-05 00:06:09 33 4
gpt4 key购买 nike

这真的很简单。我有一个 wcf 服务(没什么特别的,只是新项目-> WCF 服务应用程序),它在 Visual Studio 中运行良好。当我将它部署到集群 IIS6 环境时,它主要工作。我可以发送请求并获得响应。

但是,生成的元数据始终指向集群中的特定节点,而不是集群虚拟名称。

https://clustername.test.com/WcfService1/Service1.svc

在 HTML 中显示以下内容:
Service1 Service

You have created a service.

To test this service, you will need to create a client
and use it to call the service. You can do this using
the svcutil.exe tool from the command line with the
following syntax:

svcutil.exe https://node1.test.com/DocrRetention/Service1.svc?wsdl

它显示节点名称 (node1.test.com) 而不是集群名称。
https://clustername.test.com/WcfService1/Service1.svc?wsdl 

显示以下 xml:
...
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="https://node1.test.com/WcfService1/Service1.svc?xsd=xsd0" namespace="http://tempuri.org/"/>
<xsd:import schemaLocation="https://node1.test.com/WcfService1/Service1.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
<xsd:import schemaLocation="https://node1.test.com/WcfService1/Service1.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/WcfService1"/>
</xsd:schema>
</wsdl:types>
...
<wsdl:service name="Service1">
<wsdl:port name="BasicHttpBinding_IService1" binding="tns:BasicHttpBinding_IService1">
<soap:address location="https://node1.test.com/WcfService1/Service1.svc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

同样,显示节点名称而不是虚拟主机。

那么我的 web.config 是什么样的?它很小,所以我会展示整个东西。
<?xml version="1.0"?>
<configuration>

<system.web>
<customErrors mode="Off"/>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding>
<security mode="Transport"/>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="WcfService1.Service1">
<endpoint binding="basicHttpBinding" contract="WcfService1.IService1"/>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>

</configuration>

最佳答案

据我所知,WSDL 中的 URL 默认来自托管服务器。 .NET 3.5 SP1 的一些知识库引入了可以使用来自主机 header 的 URL 的新行为。此行为也包含在 .NET 4.0 中。支票:useRequestHeadersForMetadataAccess .文末article你对这种行为有一些描述。

关于wcf - 生成的元数据 (WSDL) 中的 .net 4 WCF 端点指向节点而不是托管在负载平衡 (NLBS) IIS6 上的虚拟主机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3630156/

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