Click here to Skip to main content
15,887,869 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am creating a service object once and then using it in the loop.

But sometimes I am getting the runtime exception as follows.

Exception:
An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail.

C#
if (webService != null)
{
     webService.Abort();
}
webService = new ServiceClient();


for (int i = 0; i < 100; i++)
{
 // my code goes here
 webService.UpdateLog();
}


What is the major cause for this.

What I have tried:

I have tried all the cases which were posted about this type of exception. But not working.
Posted
Updated 5-Dec-16 1:40am
Comments
F-ES Sitecore 5-Dec-16 7:22am    
Have you looked at the inner FaultException for the fault code and detail?

Read what the error says:
An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail.

You need to use the debugger to run your app, and then examine the exception object when the problem occurs - particularly the inner exception which should give you the information you need to either fix the problem of at least google the error and see what others have done with it.

We can't do any of that for you!
 
Share this answer
 
I checked the InnerException it says

C#
"The message could not be processed. This is most likely because the action 'http://tempuri.org/IService/UpdateLog' is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings. The security context token would be invalid if the service aborted the channel due to inactivity. To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the service endpoint's binding."


I have checked the settings, the service is working fine but sometimes it is throwing exception inside the loop.

XML
<bindings>

      <wsHttpBinding>
        <binding name="WSHttpBinding_IService" closeTimeout="00:10:00" openTimeout="00:10:00" sendTimeout="00:10:00" receiveTimeout="00:10:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
          <readerQuotas maxStringContentLength="2147483647" />
        </binding>
      </wsHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://...../Service.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService" contract="ServiceReference2.IService" name="WSHttpBinding_IService">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>
    </client>
 
Share this answer
 
v4
Comments
BillW33 5-Dec-16 11:51am    
You should not add a "Solution" to clarify your question. Instead use the "Improve Question" button to add to or clarify your original question.
Srinubabu Ravilla 6-Dec-16 3:49am    
Unexpectedly I clicked on the Accept solution button. Then I redo the change and improved the question.

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