本文介绍了如何解决此异常“从另一方收到了一个不安全或不正确安全的故障”。请参阅内部故障代码以了解故障代码和详细信息。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个服务对象,然后在循环中使用它。



但有时我得到的运行时异常如下。



例外:

从另一方收到无担保或错误保护的故障。请参阅内部FaultException以获取故障代码和详细信息。



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.

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.

推荐答案

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!


"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.

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


这篇关于如何解决此异常“从另一方收到了一个不安全或不正确安全的故障”。请参阅内部故障代码以了解故障代码和详细信息。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 01:01