【发布时间】:2019-04-15 15:28:35
【问题描述】:
我在尝试启动我的服务时收到以下错误:
Could not start the Service: System.InvalidOperationException: This service has multiple endpoints listening at 'https://b2e.my.loc:8093/' which share the same initiating action 'http://localhost:8080/kestrel/AirService'. As a result, messages with this action would be dropped since the dispatcher would not be able to determine the correct endpoint for handling the message. Please consider hosting these Endpoints at separate ListenUris.
我们有一个应用程序使用第三方 WSDL 来搜索和预订航班。
我们还有另一个 winform 应用程序,它从上面的 wsdl 中获取生成的 reference.cs
我们的想法是创建一个“模拟器”,因此我们实际上是在调用模拟器本身并生成我们需要的数据(类似于模拟),而不是调用真正的 WSDL
考虑以下由 WSDL 生成的 reference.cs 文件:
namespace FlightWCF
{
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(Namespace = "", ConfigurationName = "FlightWCF.ISearch")]
public interface ISearch
{
[System.ServiceModel.OperationContractAttribute(Action = "http://localhost:8080/kestrel/AirService", ReplyAction = "*")]
FlightWCF.serviceResponse1 service(FlightWCF.serviceRequest1 request);
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(Namespace = "", ConfigurationName = "FlightWCF.IReserve")]
public interface IReserve
{
[System.ServiceModel.OperationContractAttribute(Action = "http://localhost:8080/kestrel/AirService", ReplyAction = "*")]
FlightWCF.serviceResponse6 service(FlightWCF.serviceRequest6 request);
}
}
这是我的 app.config 的一部分
<service name="MyFlightClass.ServiceFlight">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicSecureHttpBindingConfiguration" contract="FlightWCF.ISearch" />
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicSecureHttpBindingConfiguration" contract="FlightWCF.IReserve" />
</service>
这是使用上述代码的服务:
namespace MyFlightClass
{
class ServiceFlight : ISearch, IReserve
{
public FlightWCF.serviceResponse1 service(FlightWCF.serviceRequest1 request)
{
//DO SOMETHING
}
public FlightWCF.serviceResponse6 service(FlightWCF.serviceRequest6 request)
{
//DO SOMETHING
}
}
}
问题在于两个服务都使用相同的“操作”。
如果我更改其中一个的“操作”,它就会变得无法访问。
我找不到任何关于如何配置具有 2 个具有不同合同但具有相同操作的端点的服务的数据。
我不清楚“请考虑在单独的 ListenUris 中托管这些端点”的建议。
【问题讨论】:
标签: wcf wcf-endpoint