C# 未调用单向服务方法

C# 未调用单向服务方法,c#,wcf,C#,Wcf,我有一个WCF服务,它在单独的服务上调用单向操作。 我遇到的问题是没有收到单向服务呼叫(没有记录任何消息)。如果我更改IsOneWay=false,那么它将按预期工作 该服务托管在IIS中 代码已经精简到(我认为是)重要的部分 单程服务: [ServiceContract] public interface IOneWayService { [OperationContract(IsOneWay = true)] // changing IsOneWay to false makes e

我有一个WCF服务,它在单独的服务上调用单向操作。 我遇到的问题是没有收到单向服务呼叫(没有记录任何消息)。如果我更改
IsOneWay=false
,那么它将按预期工作

该服务托管在IIS中

代码已经精简到(我认为是)重要的部分

单程服务:

[ServiceContract]
public interface IOneWayService
{
    [OperationContract(IsOneWay = true)] // changing IsOneWay to false makes everything work as expected.
    void OneWayOperation(int param);
}



[ServiceBehavior()]
public class OneWayService : IOneWayService
{
    public void OneWayOperation(int param)
    {
        Log("OneWayService called.");
    }
}
发起呼叫的服务:

[ServiceContract]
public interface ITestService
{
    [OperationContract()]
    OperationResult DoThings();
}

[ServiceBehavior()]
public class TestService : ITestService
{
    public OperationResult DoThings()
    {
        ...
        ...

        if (some condition)
        {
            CallOneWayService();
        }

        return result;

    }

    private void CallOneWayService()
    {
        var cf = new ChannelFactory<IOneWayService>("IOneWayService");
        var channel = cf.CreateChannel();
        channel.OneWayOperation(5);
        cf.Close();
    }

}
[服务合同]
公共接口ITestService
{
[运营合同()]
操作结果DoThings();
}
[ServiceBehavior()]
公共类TestService:ITestService
{
公共操作结果DoThings()
{
...
...
如果(某些条件)
{
CallOneWayService();
}
返回结果;
}
私有void CallOneWayService()
{
var cf=新渠道工厂(“IOneWayService”);
var channel=cf.CreateChannel();
通道.单向操作(5);
cf.Close();
}
}
以及web.config:

<?xml version="1.0"?>
<configuration>

  <system.serviceModel>
    <diagnostics wmiProviderEnabled="true">
      <messageLogging logEntireMessage="false" logMalformedMessages="false" logMessagesAtServiceLevel="false" logMessagesAtTransportLevel="false" maxSizeOfMessageToLog="200000"/>
    </diagnostics>
    <bindings>
      <customBinding>

        <binding name="httpsBinaryBinding" closeTimeout="15:00:00" openTimeout="15:00:00" receiveTimeout="15:00:00" sendTimeout="15:00:00">
          <binaryMessageEncoding>
            <readerQuotas maxStringContentLength ="50000000"/>
          </binaryMessageEncoding>
          <httpsTransport authenticationScheme="Basic" maxBufferSize="320000000" maxBufferPoolSize="320000000" maxReceivedMessageSize="320000000" keepAliveEnabled="false" proxyAuthenticationScheme="Basic"/>
        </binding>

        <binding name="httpsBinaryBindingAnon" closeTimeout="15:00:00" openTimeout="15:00:00" receiveTimeout="15:00:00" sendTimeout="15:00:00">
          <binaryMessageEncoding>
            <readerQuotas maxStringContentLength ="50000000"/>
          </binaryMessageEncoding>
          <httpsTransport authenticationScheme="Anonymous" maxBufferSize="320000000" maxBufferPoolSize="320000000" maxReceivedMessageSize="320000000" keepAliveEnabled="false" proxyAuthenticationScheme="Basic"/>
        </binding>
      </customBinding>

    </bindings>

    <client>
      <endpoint address="https://localhost/OneWayService.svc" binding="customBinding" bindingConfiguration="httpsBinaryBindingAnon" contract="IOneWayService" name="IOneWayService" />
    </client>

    <services>

      <service behaviorConfiguration="commonBehavior" name="TestService">
        <endpoint binding="customBinding" bindingConfiguration="httpsBinaryBinding" contract="ITestService"/>
      </service>

      <service behaviorConfiguration="commonBehavior" name="OneWayService">
        <endpoint binding="customBinding" bindingConfiguration="httpsBinaryBindingAnon" contract="IOneWayService"/>
      </service>

    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="commonBehavior">
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <serviceAuthorization serviceAuthorizationManagerType="CustomAuthorizationManager, Common.Auth"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
  <system.web>
    <httpRuntime maxRequestLength="524288"/>
    <customErrors mode="Off"/>
    <roleManager enabled="true"/>
    <authentication mode="Windows"/>
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
  </system.web>
</configuration>