Windows Phone 8.0上的HTTPS WCF服务:无法进行身份验证

时间:2015-05-20 14:22:29

标签: c# .net wcf silverlight windows-phone-8

我的WP8.0应用程序遇到问题,我想通过BASIC身份验证从中访问HTTPS WCF服务。

所有已经在使用.NET framework 4.5的C#控制台应用上工作

工作控制台应用代码:

App.config:

ServiceReference1.WS_CubicusMobileSOAPPortTypeClient proxy = new WS_CubicusMobileSOAPPortTypeClient();
proxy.ClientCredentials.UserName.UserName = "xxxxxx";
proxy.ClientCredentials.UserName.Password = "xxxxxx";
var e = proxy2.ConnexionTestWP(anObject);

这个C#代码:

<configuration>
  <system.serviceModel>

    <bindings>
      <basicHttpBinding>
        <binding name="WS_CubicusMobileSOAPBinding" maxBufferSize="2147483647"
          maxReceivedMessageSize="2147483647">
          <security mode="Transport" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="https://xxxxx.xxxxx.xxx/xxxxx/awws/xxxxx.awws"
        binding="basicHttpBinding" bindingConfiguration="WS_CubicusMobileSOAPBinding"
        contract="ServiceReference1.WS_CubicusMobileSOAPPortType" name="WS_CubicusMobileSOAPPort" />
    </client>

  </system.serviceModel>


</configuration>

不使用WP8.0代码:

ServiceReferences.ClientConfig:

border: 1px solid red;

C#代码与控制台应用程序完全相同(除了它的Async)。

我收到一个CommunicationException,说&#34;附加信息:远程服务器返回错误:NotFound。&#34;

Fiddler唯一看到的东西: http://i.stack.imgur.com/VzYhf.png

我听说Silverlight客户端需要客户端的crossdomain.xml才能工作,所以我把这个文件包含在服务器根目录下。仍然没有工作......

我觉得我尝试了每个绑定(比如自定义绑定),每个c#代码(比如手动在WCF请求中添加Authorization标头),各种配置等......没有什么工作。

请帮帮我,我绝望了!

1 个答案:

答案 0 :(得分:0)

您在Windows Phone中使用basicHttpBinding,但在控制台应用中使用basicHttpsBinding。您是否关闭了服务器上的http