无法在WCF中调用单向操作合同

时间:2012-01-20 15:41:44

标签: wcf configuration

我有一个单向WCF服务,其主要目的是将Web页面内容作为字符串,并进行一些操作。但是我似乎无法调用Operation Contract。它只是没有被调用。如果不是WebPage Content,我发送短文本(“Hello World”),一切都按预期工作。我在web.config中将maxReceiveMessageSize设置为max但我仍然无法传递WebPage内容。这是客户端web.config

<system.serviceModel>
<bindings>
  <basicHttpBinding>

    <binding name="basicBinding" allowCookies="false" closeTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
             bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647"
             maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text"
             textEncoding="utf-8" transferMode="Buffered">

      <readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="16384" maxBytesPerRead="2147483647"
                    maxNameTableCharCount="16384"/>

      <security mode="None">
        <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default"/>
      </security>

    </binding>

  </basicHttpBinding>
</bindings>

<client>
  <endpoint name="basicHttpEndPoint"
            address="http://localhost:7777/Serializer.svc"
            binding="basicHttpBinding"
            contract="Shared.ISerializer" 
            bindingConfiguration="basicBinding" />

</client>

这是我的服务的web.config

  <system.serviceModel>
<services>
  <service name="SerializerService">
    <endpoint address=""
              binding="basicHttpBinding"
              bindingConfiguration="basicBinding"
              contract="Shared.ISerializer" />
  </service>
</services>
<bindings>
  <basicHttpBinding>
    <binding name="basicBinding" allowCookies="false" closeTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
             bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647"
             maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text"
             textEncoding="utf-8" transferMode="Buffered">

      <readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="16384" 
                    maxBytesPerRead="2147483647" maxNameTableCharCount="16384"/>

      <security mode="None">
        <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default"/>
      </security>

    </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="false"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

我错过了什么吗?提前谢谢。

1 个答案:

答案 0 :(得分:0)

查看您的配置我猜测服务实现类型不是名为SerializerService,而是实际上也在命名空间中,这意味着WCF根本不使用您的服务配置而只是使用默认端点

使用命名空间完全限定服务名称,并且应该获取您的值