c# – WCF – “由于身份验证失败,无法满足安全令牌请求”

c# – WCF – “由于身份验证失败,无法满足安全令牌请求”,第1张

概述我已经创建了一个WCF服务并将其托管在IIS7 / Windows Server 2008中. 我正在尝试在我的应用程序中使用该服务… 当我从Visual Studio(调试)运行应用程序时,我可以调用该服务,一切都按预期工作,但是,当我尝试从已发布的应用程序调用服务时,我得到上面的错误. 这是服务的web.config: <?xml version="1.0" encoding="utf-8" 我已经创建了一个WCF服务并将其托管在IIS7 / Windows Server 2008中.
我正在尝试在我的应用程序中使用该服务…
当我从Visual Studio(调试)运行应用程序时,我可以调用该服务,一切都按预期工作,但是,当我尝试从已发布的应用程序调用服务时,我得到上面的错误.

这是服务的web.config:

<?xml version="1.0" enCoding="utf-8" ?><configuration>    <connectionStrings>    ...    </connectionStrings>    <system.web>        <compilation deBUG="false" />    </system.web>    <runtime>        <generatePublisherEvIDence enabled="false"/>    </runtime>        <system.serviceModel>                       <services>                        <service name="SVCliB.SERVICE1">                <endpoint address="" binding="wshttpBinding" contract="SVCliB.SERVICE1">                    <IDentity>                        <dns value="localhost" />                    </IDentity>                </endpoint>                <endpoint address="mex" binding="mexhttpBinding" contract="IMetadataExchange" />                <host>                    <baseAddresses>                        <add baseAddress="http://localhost:8732/Design_Time_Addresses/SVCliB/SERVICE1/" />                    </baseAddresses>                </host>            </service>        </services>        <behaviors>            <serviceBehaviors>                <behavior name="">                    <serviceMetadata httpGetEnabled="true" />                    <serviceDeBUG includeExceptionDetailinFaults="false" />                </behavior>            </serviceBehaviors>        </behaviors>            </system.serviceModel></configuration>

在客户端:

SERVICE1.SERVICE1ClIEnt obJservice = new SERVICE1ClIEnt();  obJservice.ClIEntCredentials.windows.ClIEntCredential.Username = "Username";  obJservice.ClIEntCredentials.windows.ClIEntCredential.Password = "Password";  obJservice.GetData();  obJservice.Close();

它在VS中调试应用程序时有效,但在运行已发布的应用程序时不起作用.

错误:

The request for security token Could not be satisfIEd because
authentication Failed

我在Stack Overflow和其他人看了很多帖子,但到目前为止没有人帮我.

谢谢!

**编辑:

这是在客户端的web.config上:

<system.serviceModel>    <bindings>      <wshttpBinding>        <binding name="WShttpBinding_SERVICE1" closeTimeout="00:01:00"          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"          bypassproxyOnLocal="false" transactionFlow="false" hostnameComparisonMode="StrongWildcard"          maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEnCoding="Text"          textEnCoding="utf-8" useDefaultWebProxy="true" allowcookies="false">          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"            maxBytesPerRead="4096" maxnametableCharCount="16384" />          <reliableSession ordered="true" inactivityTimeout="00:10:00"            enabled="false" />          <security mode="Message">            <transport clIEntCredentialType="windows" proxyCredentialType="None"              realm="" />            <message clIEntCredentialType="windows" negotiateServiceCredential="true"              algorithmSuite="Default" />          </security>        </binding>      </wshttpBinding>    </bindings>    <clIEnt>      <endpoint address="http://server.samedomain.com:8000/SVCliB.SERVICE1.svc"        binding="wshttpBinding" bindingConfiguration="WShttpBinding_SERVICE1"        contract="SERVICE1.ISERVICE1" name="WShttpBinding_ISERVICE1">      </endpoint>    </clIEnt>  </system.serviceModel>

试过gmail用户的建议和链接如下……但仍然有同样的问题.同样的错误.

解决方法 我还是不知道问题是什么.
但是现在我切换到 basicHttpBinding with Windows Authentication. 总结

以上是内存溢出为你收集整理的c# – WCF – “由于身份验证失败,无法满足安全令牌请求”全部内容,希望文章能够帮你解决c# – WCF – “由于身份验证失败,无法满足安全令牌请求”所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/1229322.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-06-06
下一篇2022-06-06

发表评论

登录后才能评论

评论列表(0条)

    保存