WCF服务响应异常已超出最大计数 [英] WCF Service response exception The maximum count has been exceeded

查看:102
本文介绍了WCF服务响应异常已超出最大计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

0down votefavorite









我正在调用方法在我的WCF服务中执行耗时的数据操作。我还需要可靠的会话。



当我使用可靠的会话调用此方法时,我在大约4分钟后收到以下错误:



超出了最大重试次数,没有来自远程端点的响应。可靠的会议出了问题。这通常表明远程端点不再可用。



详细错误:收到HTTP响应时发生错误HTTPS:.. Service1.svc。这可能是由于服务端点绑定不使用HTTP协议。这也可能是由于服务器中止HTTP请求上下文(可能是由于服务关闭)。有关更多详细信息,请参阅服务器日志



如果我从IIS运行服务器服务已成功创建。但是,当我从visual studio执行WCFServie时,我得到了以下错误。



无法添加服务。可能无法访问服务元数据。确保您的服务正在运行并公开元数据。



如果我右键单击Service1.svc并在浏览器中查看。它会给出不同的错误。



应用程序中的服务器错误。



无法找到与绑定WSHttpBinding的端点的方案https匹配的基址。注册的基地址方案是[http]。




0down votefavorite




I am calling a method in my WCF service that performs time-consuming data operations. I also require reliable sessions.

When I call this method with reliable sessions enabled I get the following error after about 4 minutes:

The maximum retry count has been exceeded with no response from the remote endpoint. The reliable session was faulted. This is often an indication that the remote endpoint is no longer available.

Error in detail: An error occurred while receiving the HTTP response to https:..Service1.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details

If I run from IIS server service was created successfully. but, when I execute WCFServie from visual studio I got the below error.

Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.

If I right click on Service1.svc and view in browser. it will give different error like this.

Server Error in Application.

Could not find a base address that matches scheme https for the endpoint with binding WSHttpBinding. Registered base address schemes are [http].


<b>Service Web.config</b>

  <system.servicemodel>
    <client />
    <behaviors>
      <servicebehaviors>
        <behavior>
          <servicemetadata httpgetenabled="true" httpsgetenabled="true" />
          <servicedebug includeexceptiondetailinfaults="true" />
          <datacontractserializer maxitemsinobjectgraph="2147483647" />
        </behavior>
      </servicebehaviors>
      <endpointbehaviors>
        <behavior>
          <datacontractserializer maxitemsinobjectgraph="2147483646" />
        </behavior>
      </endpointbehaviors>
    </behaviors>
    <bindings>
      <wshttpbinding>
        <binding name="TestService.ITest.wsHttpBinding" closetimeout="00:02:00" opentimeout="00:02:00" receivetimeout="00:10:00" sendtimeout="00:10:00" transactionflow="true" maxbufferpoolsize="2147483646" maxreceivedmessagesize="2147483646" messageencoding="Mtom" textencoding="utf-16" allowcookies="false">
          <readerquotas maxdepth="2147483647" maxstringcontentlength="2147483647" maxarraylength="2147483647" maxbytesperread="2147483647" maxnametablecharcount="2147483647" />
          <reliablesession ordered="true" inactivitytimeout="00:15:00" enabled="true" />
          <security mode="TransportWithMessageCredential">
            <transport clientcredentialtype="Windows" />
            <message clientcredentialtype="Windows" />
          </security>
        </binding>
      </wshttpbinding>
    </bindings>
    <services>
      <service name="TestService.Test">
        <endpoint name="Test.ITest.wsHttpEndpoint" binding="wsHttpBinding" contract="TestService.ITest" bindingconfiguration="TestService.ITest.wsHttpBinding"></endpoint>
        <endpoint address="mex" binding="mexHttpsBinding" name="MexHttpsBindingEndpoint" contract="IMetadataExchange" />
      </service>
    </services>
    <servicehostingenvironment multiplesitebindingsenabled="false" />
  </system.servicemodel>
  <system.webserver>
    <modules runallmanagedmodulesforallrequests="true" />
  </system.webserver>



<b>Client application web.config.</b>



  <system.servicemodel>
    <bindings>
      <wshttpbinding>

        <binding name="TestService.ITest.wsHttpBindingEndpoint" closetimeout="00:02:00">
          openTimeout="00:02:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
          maxBufferPoolSize="2147483646" maxReceivedMessageSize="2147483646"
          messageEncoding="Mtom" allowCookies="false"&gt;
          <reliablesession inactivitytimeout="00:15:00" enabled="true" />
          <security mode="TransportWithMessageCredential">
            <transport clientcredentialtype="Windows" />
            <message clientcredentialtype="Windows" />
          </security>
        </binding>
        <binding name="TestService.ITest.wsHttpEndpoint" messageencoding="Mtom">
          <reliablesession inactivitytimeout="00:15:00" enabled="true" />
          <security mode="TransportWithMessageCredential">
            <transport clientcredentialtype="None" />
          </security>
        </binding>
      </wshttpbinding>
    </bindings>
    <client>
      <endpoint address="https://localhost:10002/Test.svc" binding="wsHttpBinding">
        bindingConfiguration="testService.ITest.wsHttpBindingEndpoint"
        contract="TestWebService.ITest" name="TestService.ITest.wsHttpEndpoint" /&gt;
    </endpoint></client>
  </system.servicemodel>





请帮助我从3天开始解决这个问题。我尝试了所有谷歌搜索解决方案,但没有工作。





感谢提前。 Anu



Please help me am working on this issue from 3 days. I tried all Google search solutions but didn't work.


thanks in Advance. Anu

推荐答案

您好朋友,感谢您的更新。请尝试以下代码更改:



首先给服务行为命名如下:

Hello friend, thanks for the update. Please try the following code changes:

First of all give a name to Service Behavior as follow:
<servicebehaviors>
   <behavior>name="mexBehavior">
      <servicemetadata httpgetenabled="true" httpsgetenabled="true" />
      <servicedebug includeexceptiondetailinfaults="true" />
      <datacontractserializer maxitemsinobjectgraph="2147483647" />
   </behavior>
</servicebehaviors>



然后将服务与Behavoir名称关联,如下所示:


Then associate the Service with the Behavoir name as follows:

<service name="TestService.Test">behaviorConfiguration="mexBehavior"></service>



此时应解决以下错误:

无法添加服务。可能无法访问服务元数据。确保您的服务正在运行并公开元数据。



试试这个并告诉我们您的更新。



- DD


By this point the following error should be resolved:
Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.

Try this and let us know your update.

- DD


我尝试了下面的代码更改。得到同样的错误。



错误:

当我从visual studio执行WCFServie时出现以下错误。



无法添加服务。可能无法访问服务元数据。确保您的服务正在运行并公开元数据。



如果我右键单击Service1.svc并在浏览器中查看。它会给出不同的错误。



应用程序中的服务器错误。



无法找到与绑定WSHttpBinding的端点的方案https匹配的基址。注册的基地址方案是[http]。






I tried below code changes. getting same error.

error:
when I execute WCFServie from visual studio I got the below error.

Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.

If I right click on Service1.svc and view in browser. it will give different error like this.

Server Error in Application.

Could not find a base address that matches scheme https for the endpoint with binding WSHttpBinding. Registered base address schemes are [http].



<servicebehaviors>
<behavior name="mexBehaviour">
  <servicemetadata httpsgetenabled="true" httpgetenabled="true"></servicemetadata>

  <servicedebug includeexceptiondetailinfaults="true"></servicedebug>
  <datacontractserializer maxitemsinobjectgraph="2147483647"></datacontractserializer>

 </behavior>
 </servicebehaviors>


<services>
<service name="TestService.Test" behaviorconfiguration="mexBehaviour">

        <endpoint name="TestService.ITest.wsHttpEndpoint" bindingconfiguration="TestService.Itest.wsHttpBinding" contract="TestService.ITest" binding="wsHttpBinding"></endpoint>
        <endpoint name="MexHttpsBindingEndpoint" contract="IMetadataExchange" binding="mexHttpsBinding" address="mex"></endpoint>

      </service></services></service>


这篇关于WCF服务响应异常已超出最大计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆