Silverlight 使用来自Windows Phone 7的自签名证书的WCF服务错误
我想将Azure上运行的WCF服务从Silverlight 使用来自Windows Phone 7的自签名证书的WCF服务错误,silverlight,wcf,windows-phone-7,ssl-certificate,Silverlight,Wcf,Windows Phone 7,Ssl Certificate,我想将Azure上运行的WCF服务从http切换到https,但当我尝试使用Windows Phone 7提供的服务时,出现以下错误: 没有可以接受消息的端点正在侦听。这通常是由不正确的地址或SOAP操作引起的。有关更多详细信息,请参阅InnerException(如果存在) 我已经创建了与服务uri同名的自签名证书,然后通过电子邮件将证书发送到Windows Phone并安装了它。但我一直收到这个消息,即使是从模拟器和真实的手机 消费服务可以从WPF和桌面Silverlight应用程序中工作
http
切换到https
,但当我尝试使用Windows Phone 7提供的服务时,出现以下错误:
没有可以接受消息的端点正在侦听。这通常是由不正确的地址或SOAP操作引起的。有关更多详细信息,请参阅InnerException(如果存在)
我已经创建了与服务uri同名的自签名证书,然后通过电子邮件将证书发送到Windows Phone并安装了它。但我一直收到这个消息,即使是从模拟器和真实的手机
消费服务可以从WPF和桌面Silverlight应用程序中工作
可湿性粉剂配置ServiceReferences.ClientConfig
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IGEOService" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="TransportWithMessageCredential" />
</binding>
<binding name="BasicHttpBinding_IAccountService" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="TransportWithMessageCredential" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://xxxxx.cloudapp.net/MainService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IGEOService"
contract="ServiceReference1.IGEOService" name="BasicHttpBinding_IGEOService" />
<endpoint address="https://xxxxx.cloudapp.net/MainService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAccountService"
contract="ServiceReference1.IAccountService" name="BasicHttpBinding_IAccountService" />
</client>
</system.serviceModel>
在服务器上
clientaccesspolicy.xml
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="SOAPAction">
<domain uri="http://*" />
<domain uri="https://*" />
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
服务配置
<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration serviceName="Diplomka" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="1" osVersion="*">
<Role name="MainWFCRole">
<Instances count="1" />
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
</ConfigurationSettings>
<Certificates>
<Certificate name="diplomka.cloudapp.net" thumbprint="539B9A0149DC1221F0F4ECA79BAD84073BF1D650" thumbprintAlgorithm="sha1" />
</Certificates>
</Role>
<Role name="WebKlient">
<Instances count="1" />
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
</ConfigurationSettings>
</Role>
</ServiceConfiguration>
服务定义
enter code here
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="Diplomka" xmlns="http://schemas.microsoft.com/ ServiceHosting/2008/10/ServiceDefinition">
<WebRole name="MainWFCRole">
<Sites>
<Site name="Web">
<Bindings>
<Binding name="Endpoint1" endpointName="Endpoint1" />
</Bindings>
</Site>
</Sites>
<Endpoints>
<InputEndpoint name="Endpoint1" protocol="https" port="443" certificate="diplomka.cloudapp.net" />
</Endpoints>
<Imports>
<Import moduleName="Diagnostics" />
</Imports>
<LocalResources>
<LocalStorage name="MainWFCRole.svclog" sizeInMB="1000" cleanOnRoleRecycle="false" />
</LocalResources>
<Certificates>
<Certificate name="diplomka.cloudapp.net" storeLocation="LocalMachine" storeName="My" />
</Certificates>
</WebRole>
<WebRole name="WebKlient">
<Sites>
<Site name="Web">
<Bindings>
<Binding name="Endpoint1" endpointName="Endpoint1" />
</Bindings>
</Site>
</Sites>
<Endpoints>
<InputEndpoint name="Endpoint1" protocol="http" port="80" />
</Endpoints>
<Imports>
<Import moduleName="Diagnostics" />
</Imports>
</WebRole>
在此处输入代码
网络配置
enter code here
<configuration>
<system.diagnostics>
<trace>
<listeners>
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="AzureDiagnostics">
<filter type="" />
</add>
</listeners>
</trace>
</system.diagnostics>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<customErrors mode="Off"/>
</system.web>
<system.serviceModel>
<services>
<service name="MainWFCRole.MainService" behaviorConfiguration="sb1">
<endpoint binding="basicHttpBinding" contract="MainWFCRole.IGEOService" bindingConfiguration="binding1"/>
<endpoint binding="basicHttpBinding" contract="MainWFCRole.IAccountService" bindingConfiguration="binding1"/>
</service>
</services>
<bindings>
<basicHttpBinding>
<!--secure wcf by TransportWithMessageCredential security-->
<binding name="binding1">
<security mode="TransportWithMessageCredential">
<message clientCredentialType="UserName"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="sb1">
<!---->
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="MainWFCRole.AccountValidator,MainWFCRole"/>
</serviceCredentials>
<!--Enable https metadata exchange endpoint-->
<serviceMetadata httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
在此处输入代码
防火墙上的端口433是否打开?您是否能够从Silverlight或WPF应用程序从运行该服务的计算机以外的计算机上使用该服务?你有没有用fiddler、wireshark或其他工具验证过流量实际上是https?我也有这个问题。请记住命名自签名证书,并将其命名为与主机名相同的名称。如果主机是localhost,则证书必须具有名称localhost。还记得在使用仿真器时,每次重新启动仿真器时都必须安装证书。防火墙上的端口433是否打开?您是否能够从Silverlight或WPF应用程序从运行该服务的计算机以外的计算机上使用该服务?你有没有用fiddler、wireshark或其他工具验证过流量实际上是https?我也有这个问题。请记住命名自签名证书,并将其命名为与主机名相同的名称。如果主机是localhost,则证书必须具有名称localhost。还请记住,在使用仿真器时,每次重新启动仿真器时都必须安装证书。