【问题标题】:WCF One Way Call Not ExecutingWCF 单向调用未执行
【发布时间】:2012-01-21 06:59:18
【问题描述】:

我有一个 WCF 服务,其方法用 [OperationContract(IsOneWay=true)] 修饰。

[ServiceContract]
public interface IService
{
    [OperationContract(IsOneWay=true)]
    void DoThis(DateTime value);
} 

当我调用这个方法时,没有引发异常。但是,WCF 方法内部没有执行任何操作,例如数据库操作(插入、更新……)

我错过了什么?

我的 WCF 配置

<system.serviceModel>
    <bindings>
          <basicHttpBinding>
              <binding closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
                 maxBufferSize="50000000" maxBufferPoolSize="50000000" maxReceivedMessageSize="50000000">
                  <readerQuotas maxDepth="500000000" maxStringContentLength="500000000" maxArrayLength="500000000"
                        maxBytesPerRead="500000000" maxNameTableCharCount="500000000" />
              </binding>
          </basicHttpBinding>
      </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- 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="true"/>
      <dataContractSerializer ignoreExtensionDataObject="true" maxItemsInObjectGraph="6553600"/>
      <serviceThrottling maxConcurrentCalls="500" maxConcurrentInstances="500" maxConcurrentSessions="500"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>

我如何称呼我的服务:

MyService proxy = new MyService();
proxy.DoThis(DateTime.Now);

其他 WCF 方法按预期工作,只是没有 [OperationContract(IsOneWay=true)]。

提前致谢。

【问题讨论】:

  • 接口定义是正确的,所以我们需要配置和实现细节来帮助你。
  • 谢谢,我刚刚更新了问题。
  • 听起来很蠢,但是如果你设置了IsOneway=false,这个方法会被调用吗?您只是说其他方法按预期工作。
  • 你确定实现的方法中的代码执行了吗? (可能是一个愚蠢的问题,但有时它是简单的事情......)
  • 在服务上打开 WCF 跟踪,看看调用是否以某种方式失败。单向消息不会向调用者显示失败

标签: c# asp.net wcf


【解决方案1】:

我通过打开跟踪发现了问题。由于是单向调用,客户端不会识别异常或响应。

谢谢大家。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-15
    • 1970-01-01
    相关资源
    最近更新 更多