我以免费网站模式将WCF服务上传到Azure网站
现在,我可以在https://<mysite>.azurewebsites.net/MyService.svc
使用Windows Phone设备和模拟器中的Internet Explorer连接到我的服务,而不会对证书发出任何警告。
接下来,我创建了Windows Phone项目,并使用上面的URL为我的WCF服务添加了服务引用。
我的应用程序在模拟器中运行良好但在Windows Phone设备上无法运行。我在调用服务方法时得到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.
。
我知道Windows Phone设备上自签名证书的问题。但azurewebsites.net证书由 Baltimore CyberTrust Root 证书签署。它是Windows Phone OS 7.1 http://msdn.microsoft.com/en-us/library/windowsphone/develop/gg521150(v=vs.105).aspx#BKMK_VeriSignBusinessUnitedStates
的根是否可以从Windows Phone设备调用Azure免费网站托管的安全WCF服务?或者我需要购买自己的证书?
我的 Web.config 用于WCF服务:
<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" />
答案 0 :(得分:0)
感谢this post,问题得到了解决 显然,这款手机是全新的,开箱即用,时钟已经过时了。有趣的是Windows自动时钟同步不起作用。
因此,我可以在设备上设置正确的日期和时间后通过HTTPS调用WCF服务。此外,我可以在手机上下载和安装后使用自签名的证书(有关详细信息,请参阅http://wp7certinstaller.codeplex.com/)。