1

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

请帮助我。

4

0 回答 0