我已经创建了一个WCF服务并将其托管在IIS7 /
Windows Server 2008中.
我正在尝试在我的应用程序中使用该服务…
当我从Visual Studio(调试)运行应用程序时,我可以调用该服务,一切都按预期工作,但是,当我尝试从已发布的应用程序调用服务时,我得到上面的错误.
我正在尝试在我的应用程序中使用该服务…
当我从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>
解决方法
我还是不知道问题是什么.
但是现在我切换到 basicHttpBinding with Windows Authentication.
但是现在我切换到 basicHttpBinding with Windows Authentication.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。