wcf中的奇怪操作合同行为

时间:2013-11-09 04:09:45

标签: wcf wcf-rest

我有一个WCF休息服务操作合同,内部调用另一个服务。 在拨打其他服务时,它会添加证书并拨打其他服务。

我的运营合同如下

 [OperationContract]
        [WebInvoke(Method = "GET",
            ResponseFormat = WebMessageFormat.Json,
            UriTemplate = "/report/videodata/{component}/{count}")]
        ServiceResponse CallcomponentHandler(string component, string count);

我的实现如下

public ServiceResponse CallcomponentHandler(string component, string count)
    {
       //Making HTTP Get Request to another service
        return utility.GetResponse(Url);           
    }

但是当我尝试从Internet Explorer中使用此操作时,会多次调用它。

请注意其他服务有异步方式。

我尝试在web.config文件中添加maxReceivedMessageSize,maxStringContentLength但仍然无法解决此问题。

下面是我的web.config文件。

<?xml version="1.0"?>
<configuration>  
  <system.web>
    <compilation debug="true" targetFramework="4.0"/>
    <httpRuntime/>
  </system.web>
  <system.serviceModel>
    <services>
      <service name="Video.GetDetails" behaviorConfiguration="MyServiceBehavior">
        <endpoint name="rest" address="" binding="webHttpBinding" contract="Video.IService1" behaviorConfiguration="restBehavior"/>
      </service>
    </services>
    <bindings>
      <webHttpBinding>
        <binding name="StreamedRequestWebBinding"
        bypassProxyOnLocal="true"
                 useDefaultWebProxy="false"
                 hostNameComparisonMode="WeakWildcard"
                 sendTimeout="10:15:00"
                 openTimeout="10:15:00"
                 receiveTimeout="10:15:00"
                 maxReceivedMessageSize="9223372036854775807"
                 maxBufferPoolSize="9223372036854775807"
                 maxBufferSize="2147483647"
                 transferMode="StreamedRequest" >
          <readerQuotas maxArrayLength="2147483647" maxStringContentLength="2147483647" />
        </binding>
      </webHttpBinding>
      <basicHttpBinding>
        <binding name="Binding1" closeTimeout="04:01:00" openTimeout="04:01:00" receiveTimeout="04:10:00" sendTimeout="04:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="1073741824" maxBufferPoolSize="1073741824" maxReceivedMessageSize="1073741824" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
          <readerQuotas maxDepth="1073741824" maxStringContentLength="1073741824" maxArrayLength="1073741824" maxBytesPerRead="1073741824" maxNameTableCharCount="1073741824"/>
        </binding>
        <!-- For Cyber Source bindings-->
        <binding name="ITransactionProcessor" closeTimeout="04:01:00" openTimeout="04:01:00" receiveTimeout="04:10:00" sendTimeout="04:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="1073741824" maxBufferPoolSize="1073741824" maxReceivedMessageSize="1073741824" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
          <readerQuotas maxDepth="1073741824" maxStringContentLength="1073741824" maxArrayLength="1073741824" maxBytesPerRead="1073741824" maxNameTableCharCount="1073741824"/>
          <security mode="TransportWithMessageCredential">
            <transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
            <message clientCredentialType="UserName" algorithmSuite="Default"/>
          </security>
        </binding>
      </basicHttpBinding>
      <!--Cyber Source bindings ends here-->
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="MyServiceBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="restBehavior">
          <webHttp/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <protocolMapping>
      <add binding="basicHttpsBinding" scheme="https"/>
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="true"/>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
  </system.webServer>
</configuration>

请帮我解决这个问题。

0 个答案:

没有答案