[英]Wcf basicHttpBinding not working in Windows 8.1 app store
I wrote a Wcf Service and its configuration file is 我写了一个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>
This working fine for a console app or WPF app. 对于控制台应用程序或WPF应用程序,此工作正常。 But when I am using same service for windows 8.1 app i am getting this exception
但是,当我为Windows 8.1应用程序使用相同的服务时,却收到此异常
The HTTP request is unauthorized with client authentication scheme 'Negotiate'.
客户端身份验证方案“协商”未授权HTTP请求。 The authentication header received from the server was 'Negotiate,NTLM'.
从服务器收到的身份验证标头是“ Negotiate,NTLM”。
before using Service proxy add a lines with identification: 在使用服务代理之前,添加带有标识的行:
var client = new ServiceReference1.Service1Client(); var client = new ServiceReference1.Service1Client(); client.ClientCredentials.Windows.ClientCredential.UserName = "windows user name";
client.ClientCredentials.Windows.ClientCredential.UserName =“ Windows用户名”;
client.ClientCredentials.Windows.ClientCredential.Password = "user passw"; client.ClientCredentials.Windows.ClientCredential.Password =“用户密码”;
call a service method 调用服务方法
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.