WCF单向呼叫未执行

时间:2012-01-21 06:59:18

标签: c# asp.net wcf

我有一个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)]。

提前致谢。

1 个答案:

答案 0 :(得分:0)

我通过启用跟踪找到了问题。由于它是单向调用,因此客户端无法识别异常或响应。

谢谢大家。