C# “从另一方收到不安全或错误安全的错误”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15893286/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-10 18:18:28  来源:igfitidea点击:

"An unsecured or incorrectly secured fault was received from the other party"

c#wpfwcf

提问by Ranjita Das

I'm getting:

我越来越:

Error

错误

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

“从另一方收到一个不安全或不正确保护的故障。有关故障代码和详细信息,请参阅内部故障异常。”

I've done this on the client side and I've done the same in a console application, but that error came may be something conflict.

我已经在客户端做了这个,我在控制台应用程序中做了同样的事情,但是出现的错误可能是一些冲突。

I've checked the app.configas well.

我也检查过了app.config

Code is:

代码是:

<client>
  <endpoint address="net.tcp://localhost:5054/player" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IPlayerService" contract="PlayerService.IPlayerService" name="NetTcpBinding_IPlayerService">
    <identity>
      <dns value="pident.cloudapp.net"/>
    </identity>
  </endpoint>
  <endpoint address="net.tcp://localhost:5049/public" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IPublicService" contract="Public Service.IPublicService" name="NetTcpBinding_IPublicService"/>
  <endpoint address="net.tcp://localhost:5051/user" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IUserService" contract="User Service.IUserService" name="NetTcpBinding_IUserService">
    <identity>
      <dns value="pident.cloudapp.net"/>
    </identity>
  </endpoint>

Does anyone have any idea?

有谁有想法吗?

回答by stack247

I just had this issue and had to turn off security context on WCF bindings. You need to turn them off on the bindings in both the client and the service.

我刚刚遇到了这个问题,不得不关闭 WCF 绑定的安全上下文。您需要在客户端和服务中的绑定上关闭它们。

Here's the config file if your WCF is IIS-hosted:

如果您的 WCF 是 IIS 托管的,则这是配置文件:

<ws2007FederationHttpBinding>
    <binding>
        <security mode="TransportWithMessageCredential">
            <message establishSecurityContext="false" />
        </security>
    </binding>
</ws2007FederationHttpBinding>

See this post: http://stack247.wordpress.com/2013/05/28/an-unsecured-or-incorrectly-secured-fault-was-received-from-the-other-party/

看到这个帖子:http: //stack247.wordpress.com/2013/05/28/an-unsecured-or-incorrectly-secured-fault-was-received-from-the-other-party/

回答by Shiva Saurabh

In command prompt, check if the testclient is accepting the parameters correctly or not.

在命令提示符下,检查 testclient 是否正确接受参数。

Example:
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE>wcftestclient.exe http://localhost:31/AuthenicationService.svc?wsdl

例子:
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE>wcftestclient.exe http://localhost:31/AuthenicationService.svc?wsdl

If the inputs you have given is not matching, there is problem with the service.
Rather you have to re-look into the service created.
If there is no problem found in it, only then go for the client side.

如果您提供的输入不匹配,则服务存在问题。
相反,您必须重新查看创建的服务。
如果没有发现问题,那么才去客户端。