Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
发送加密数据wcf-windows phone_Wcf_Windows Phone 7 - Fatal编程技术网

发送加密数据wcf-windows phone

发送加密数据wcf-windows phone,wcf,windows-phone-7,Wcf,Windows Phone 7,我正在使用WCF服务与DB通信。我的WP7.5应用程序通过WCF将数据发送到DB。我使用basichttpbinding,因为WP只支持这个。我想以加密的形式发送数据。我知道,https用于这些目的。 这是我的web.config: <system.serviceModel> <behaviors> <serviceBehaviors> <behavior name="serviceBehavior"> <servic

我正在使用WCF服务与DB通信。我的WP7.5应用程序通过WCF将数据发送到DB。我使用basichttpbinding,因为WP只支持这个。我想以加密的形式发送数据。我知道,https用于这些目的。 这是我的web.config:

<system.serviceModel>
<behaviors>
  <serviceBehaviors>
    <behavior name="serviceBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<bindings>
  <basicHttpBinding>
      <binding name="baseBinding" >
      </binding>
  </basicHttpBinding>
</bindings>
<services>
  <service behaviorConfiguration="serviceBehavior" name="TestWCF.WcfNotificationService.WcfNotificationService">
    <endpoint address="base" binding="basicHttpBinding" bindingConfiguration="baseBinding"
      contract="TestWCF.WcfNotificationService.IWcfNotificationService" />
    <host>
      <timeouts openTimeout="00:05:00" />
    </host>
  </service>
</services>

我在谷歌上搜索发现,我必须将securityMode设置为transport,但当我尝试更新WP应用程序中的服务引用时,它给了我一个例外。你能帮我吗,如何实现这一点,数据将被加密? 非常感谢

编辑

这就是错误:

找不到与绑定为BasicHttpBinding的终结点的https方案匹配的基址。注册的基址方案为[http]


当我在客户端中更新服务引用时,我得到了这一点。

如果您在IIS中托管WCF服务,请确保已使用SSL证书配置https绑定。查看如何配置此功能。如果您是自托管服务,请确保添加如下基本地址:

        <host>
          <baseAddresses>
            <add baseAddress="https://[machineName]/Service.svc"/>
          </baseAddresses>
        </host>

看起来您的配置有问题。BasicHttpBinding需要配置为支持https。例如,请看这里:

正如上面指出的,您需要更改:

<basicHttpBinding>
      <binding name="baseBinding" >
      </binding>
 </basicHttpBinding>


此外,改变

<serviceMetadata httpGetEnabled="true"/>



它会引发什么异常?我已经尝试过:“/>但它不起作用。同样的问题您是在IIS上托管还是在selfhost上托管?如果您是在自主机中,则传递的基址应该以…开始…我现在在Visual Studio development server上使用它,但wcf将托管在IIS上。因此,我尝试了SSL证书,但它不起作用。当我在IIS管理器中单击“浏览”时,页面/wcf服务未加载SSL正在工作。但问题是当我的WP应用程序尝试通过wcf服务连接时。我得到以下异常:提供的URI方案“https”无效;应为“http”。参数名称:Via感谢您的回答,但当我的WP应用程序尝试通过WCF连接时,我得到错误:提供的URI方案“https”无效;应为“http”。参数名称:WP端的配置/代码是什么?您的服务是否与普通的.NET控制台应用程序配合使用?
<serviceMetadata httpGetEnabled="true"/>
<serviceMetadata httpsGetEnabled="true"/>