Click here to Skip to main content
15,884,920 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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].


XML
<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>


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
Posted
Updated 12-Jun-14 8:37am
v4
Comments
Debabrata_Das 12-Jun-14 12:20pm    
Please share your web.config changes.
Member 10880804 12-Jun-14 13:07pm    
Hi,

Thanks for your response,

Pease check solution for my web.config files.

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

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

Then associate the Service with the Behavoir name as follows:
HTML
<service name="TestService.Test">behaviorConfiguration="mexBehavior"></service>

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
 
Share this answer
 
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].



HTML
<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>
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900