Wcf 我们可以让一个服务实现多个serviceContract吗。每个servicecontract都作为具有相同地址的独立端点公开

Wcf 我们可以让一个服务实现多个serviceContract吗。每个servicecontract都作为具有相同地址的独立端点公开,wcf,Wcf,我面临的问题是,相同的配置可以在我的开发机器上工作,但不能在其他机器上工作。 我有四个servicecontract接口。这些接口由单个服务实现。对于每个服务契约,我有单独的端点,但这些端点有相同的地址。此设置在我的机器上工作,但在测试机器上失败。 请澄清 这是配置文件 <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.serviceModel> <services>

我面临的问题是,相同的配置可以在我的开发机器上工作,但不能在其他机器上工作。 我有四个servicecontract接口。这些接口由单个服务实现。对于每个服务契约,我有单独的端点,但这些端点有相同的地址。此设置在我的机器上工作,但在测试机器上失败。 请澄清

这是配置文件

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
  <service name="ABC.Toolkit.PluginHost.AdapterService">
    <endpoint address="AdapterService" bindingConfiguration="DicomConfigNamedPipeBinding"
      binding="netNamedPipeBinding" contract="ABC.ILocalSystemStore">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="AdapterService" bindingConfiguration="DicomConfigNamedPipeBinding"
          binding="netNamedPipeBinding" contract="ABC.IRemoteDeviceStore">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="AdapterService" bindingConfiguration="DicomConfigNamedPipeBinding"
          binding="netNamedPipeBinding" contract="ABC.IPrinterStore">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="AdapterService" bindingConfiguration="DicomConfigNamedPipeBinding"
          binding="netNamedPipeBinding" contract="ABC.ITemplateStore">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <host>
      <baseAddresses>
        <add baseAddress="net.tcp://localhost:8000/Services/" />
        <add baseAddress="net.pipe://localhost/Services" />
      </baseAddresses>
    </host>
  </service>
  <service name="ABC.RemoteDeviceTestService">
    <endpoint address="net.pipe://localhost/Services/RemoteDeviceTestService" bindingConfiguration="DicomConfigNamedPipeBinding"
            binding="netNamedPipeBinding" contract="ABC.IRemoteDeviceTest">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <host>
      <baseAddresses>
        <add baseAddress="net.tcp://localhost:8000/Services/" />
        <add baseAddress="net.pipe://localhost/Services" />
      </baseAddresses>
    </host>
  </service>
  <service name="ABC.PrinterTestService">
    <endpoint address="net.pipe://localhost/Services/PrinterTestService" bindingConfiguration="DicomConfigNamedPipeBinding"
           binding="netNamedPipeBinding" contract="ABC.IPrinterTest">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <host>
      <baseAddresses>
        <add baseAddress="net.tcp://localhost:8000/Services/" />
        <add baseAddress="net.pipe://localhost/Services" />
      </baseAddresses>
    </host>
  </service>      
</services>
<bindings>
  <netTcpBinding>
    <binding name="NetTcp_Reliable" sendTimeout="00:00:10"
             receiveTimeout="24.20:31:23.6470000">
      <reliableSession ordered="true" inactivityTimeout="24.20:31:23.6470000"
          enabled="true" />
    </binding>
  </netTcpBinding>
  <netNamedPipeBinding>
    <binding name="DicomConfigNamedPipeBinding"  closeTimeout="23:59:59" openTimeout="23:59:59" receiveTimeout="23:59:59"
             sendTimeout="23:59:59" transactionFlow="false" transferMode="Buffered" maxBufferPoolSize="2147483646" maxBufferSize="2147483646"
             maxConnections="10" maxReceivedMessageSize="2147483646">
      <readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      <security mode="Transport" />
    </binding>
  </netNamedPipeBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="serviceBehave">
      <!-- To avoid disclosing metadata information, 
      set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="false"/>
      <!-- To receive exception details in faults for debugging purposes, 
      set the value below to true.  Set to false before deployment 
      to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
  </serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>


我收到的错误消息是端点调度器上的契约筛选器不匹配

好吧,这根本不应该是个问题,您可以发布完整的配置文件结构,并提供关于哪些不起作用的更多信息(任何特定错误消息)您可以尝试使用一个端点,如果可以的话。如果确实如此,则添加另一个端点并查看。如果现在不起作用,请尝试更改第二个端点的地址,看看是否起作用。希望此链接对您有所帮助: