.net WCF“对 SSPI 的调用失败,请参阅内部异常”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6076479/
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-09-03 15:35:46  来源:igfitidea点击:

WCF 'A Call to SSPI Failed, see inner exception'

.netvb.netwcfconfigsspi

提问by

I had a self-hosted win service WCF installed and running at one point.

我曾经安装并运行了一个自托管的 win 服务 WCF。

Naturally, I had to make some changes. So I changed the base address back to my local workstation and made the changes. It worked fine.

自然,我不得不做出一些改变。所以我将基地址改回我的本地工作站并进行了更改。它工作得很好。

Now it's time to redistribute and... Well... It keeps hosing and I can't figure it out.

现在是重新分配和...的时候了...它一直在冲洗,我无法弄清楚。

From the app.config file:

从 app.config 文件:

<system.serviceModel>
<services>
  <service behaviorConfiguration="ExStreamWCF.Service1Behavior"
    name="ExStreamWCF.Service1">
    <endpoint address="" binding="netTcpBinding" bindingConfiguration=""
      contract="ExStreamWCF.IService1">
      <identity>
        <dns value="Devexstream-2" />
        <!--<dns value="vmwin2k3sta-tn2" />-->
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
      contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="net.tcp://Devexstream-2:8080/Service" />
        <!--<add baseAddress="net.tcp://vmwin2k3sta-tn2:8080/Service" />-->
      </baseAddresses>
    </host>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="ExStreamWCF.Service1Behavior">
      <serviceMetadata httpGetEnabled="false" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>

From the web.config file (long story):

从 web.config 文件(长篇故事):

  <system.serviceModel>
    <services>
  <service behaviorConfiguration="ExStreamWCF.Service1Behavior"
    name="ExStreamWCF.Service1">
    <endpoint address="" binding="netTcpBinding" bindingConfiguration=""
      contract="ExStreamWCF.IService1">
      <identity>
        <dns value="Devexstream-2" />
        <!--<dns value="vmwin2k3sta-tn2" />-->
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
      contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="net.tcp://Devexstream-2:8080/Service" />
        <!--<add baseAddress="net.tcp://vmwin2k3sta-tn2:8080/Service" />-->
      </baseAddresses>
    </host>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="ExStreamWCF.Service1Behavior">
      <serviceMetadata httpGetEnabled="false" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>

Any guesses on what I'm doing wrong?

对我做错了什么有任何猜测吗?

采纳答案by

Thanks tomasr, it was a misconfigured SPN.

感谢 tomasr,这是一个配置错误的 SPN。

Too bad there's no functionality on this site to close your own question, I'll have to wait 2 days to choose this one :-)

太糟糕了,此站点上没有关闭您自己问题的功能,我必须等待 2 天才能选择此问题:-)

Thanks again!

再次感谢!

回答by vibhu

i removed identity element from config for local testing when i was not connected to domain. It works.

当我没有连接到域时,我从用于本地测试的配置中删除了标识元素。有用。

reference -

参考 -

http://blogs.msdn.com/b/jpsanders/archive/2010/10/14/wcf-client-inner-exception-quot-the-security-support-provider-interface-sspi-negotiation-failed-quot.aspx

http://blogs.msdn.com/b/jpsanders/archive/2010/10/14/wcf-client-inner-exception-quot-the-security-support-provider-interface-sspi-negotiation-failed-quot。 aspx

回答by THEIVA Uthayathas

under the <system.serviceModel>
<bindings>
    <netTcpBinding>
        <binding name="netTcp">
            <security mode="None">
        </binding>
    </netTcpBinding>
</bindings>

add this to bindingConfiguration in the endpoint

将此添加到端点中的 bindingConfiguration

ref: https://www.youtube.com/watch?v=KYDBjoCYAC4&list=PL6n9fhu94yhVxEyaRMaMN_-qnDdNVGsL1&index=53

参考:https: //www.youtube.com/watch?v=KYDBjoCYAC4 &list =PL6n9fhu94yhVxEyaRMaMN_-qnDdNVGsL1 &index =53

回答by Shraddhesh Dongare

Check for framework installed, framework 4.5.x should be used. It might be upgraded. Restore old version and it will work.

检查是否安装了框架,应使用框架 4.5.x。可能会升级。恢复旧版本,它会工作。