0
votes

I uploaded WCF service to the Azure Web Site in Free web site mode.
Now I can connect to my service at https://<mysite>.azurewebsites.net/MyService.svc using Internet Explorer in Windows Phone device and emulator without any warnings about certificate.

Next I created Windows Phone project and added Service Reference to my WCF service using url above.

My application works great in emulator but can't on Windows Phone device. I get System.ServiceModel.Security.MessageSecurityException: An unsecured or incorrectly secured fault was received from the other party. -> System.ServiceModel.FaultException: An error occurred when verifying security for the message. when calling service method.

I know about problem with self signed sertificates on Windows Phone devices. But azurewebsites.net certificate signed by Baltimore CyberTrust Root certificate. It's root for Windows Phone OS 7.1 http://msdn.microsoft.com/en-us/library/windowsphone/develop/gg521150(v=vs.105).aspx#BKMK_VeriSignBusinessUnitedStates

Is it possible to call secured WCF services hosted with Azure free web sites from Windows Phone device? Or I need buy own certificate?

My Web.config for WCF service:

<services>
  <service name="SmallService.Services.MyService" behaviorConfiguration="SecureServiceBehavior">
    <endpoint address=""
              binding="basicHttpBinding"
              bindingConfiguration="SecureServiceBinding"
              contract="SmallService.Services.IMyService" />
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="SecureServiceBehavior">
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
      <serviceAuthorization principalPermissionMode="UseAspNetRoles" roleProviderName="DefaultRoleProvider" />
      <serviceCredentials>
        <userNameAuthentication userNamePasswordValidationMode="MembershipProvider" membershipProviderName="DefaultMembershipProvider" />
      </serviceCredentials>
    </behavior>
  </serviceBehaviors>
</behaviors>
<bindings>
  <basicHttpBinding>
    <binding name="SecureServiceBinding">
      <security mode="TransportWithMessageCredential">
        <message clientCredentialType="UserName" />
      </security>
    </binding>
  </basicHttpBinding>
</bindings>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
1

1 Answers

0
votes

Thanks to this post the issue was resolved.
Apparently, the phone was a brand new, just out of the box and clock was way off. Interesting thing that Windows automatic clock synchronization did not work.

So I can call WCF service over HTTPS after setting right date and time on device. Also I can use self-signed sertificates after downloading and installing on phone (see http://wp7certinstaller.codeplex.com/ for more information).