[英]Wcf basicHttpBinding not working in Windows 8.1 app store
我写了一个Wcf服务,它的配置文件是
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceTypeBehaviors" >
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="securityDemo">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="WcfDemo.EmpService" behaviorConfiguration="MyServiceTypeBehaviors">
<host>
<baseAddresses>
<add baseAddress="http://localhost:3003/"/>
</baseAddresses>
</host>
<endpoint address="" binding="basicHttpBinding" contract="WcfDemo.IEmpService" bindingConfiguration="securityDemo"/>
</service>
</services>
</system.serviceModel>
对于控制台应用程序或WPF应用程序,此工作正常。 但是,当我为Windows 8.1应用程序使用相同的服务时,却收到此异常
客户端身份验证方案“协商”未授权HTTP请求。 从服务器收到的身份验证标头是“ Negotiate,NTLM”。
在使用服务代理之前,添加带有标识的行:
var client = new ServiceReference1.Service1Client(); client.ClientCredentials.Windows.ClientCredential.UserName =“ Windows用户名”;
client.ClientCredentials.Windows.ClientCredential.Password =“用户密码”;
调用服务方法
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.