简体   繁体   English

WCF basicHttpBinding在Windows 8.1应用商店中不起作用

[英]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”。

  • Deploy a WCF service on IIS Local (because IIS Express are not so flexible), set off Anonymous Authentication and set on Windows Integrated Authentication. 在IIS Local上部署WCF服务(因为IIS Express不太灵活),关闭“匿名身份验证”并在Windows集成身份验证上设置。
  • make service reference in target Win 8 app. 在目标Win 8应用程序中进行服务引用。
  • 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 调用服务方法

  • profit 利润

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Windows应用商店应用中使用MIDI(Win 8.1) - Working with MIDI in Windows Store App (Win 8.1) Mutli语言Windows Phone 8.1应用程序无法在Windows Store上运行 - Mutli Language Windows Phone 8.1 app not working on Windows Store Windows 8.1 WCF客户端无法通过BasicHttpBinding通过摘要身份验证连接到服务 - Windows 8.1 WCF client fails to connect to service with digest authentication over BasicHttpBinding Windows Phone 8.1 Store应用程序-链接到商店 - Windows Phone 8.1 Store app - Link to store Windows Store应用程序(Windows 8.1)中的TripleDES加密 - TripleDES Encryption in Windows Store app (Windows 8.1) Windows Phone 8.1 App在App Store上的发行 - Windows Phone 8.1 App on App Store Issue WCF basicHttpBinding设置在Windows服务中托管的凭据 - WCF basicHttpBinding Setting Credential hosted in Windows service Windows Phone错误处理:具有BasicHttpBinding和TransportWithMessageCredential的WCF - Windows Phone Error Handling: WCF with BasicHttpBinding and TransportWithMessageCredential Windows 8 Store App和WCF服务 - Windows 8 Store App and WCF service 检测Windows 8.1商店应用程序是否在SplittView或FullView中 - Detect if Windows 8.1 store app is in SplittView or FullView
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM