asp.net - 无法正确添加服务引用

标签 asp.net windows-phone-7 c#-4.0 azure

我在 443 端口下有一个 notificationService,但是当我尝试将其添加到 Windows Phone 7 服务引用时,我不能,那么它是否可以链接到我的服务部署在 443 端口下的事实。

http://localhost:443/NotificationService.svc 发出 HTTP 请求时发生错误。这可能是由于在 HTTPS 情况下未使用 HTTP.SYS 正确配置服务器证书。这也可能是由于客户端和服务器之间的安全绑定(bind)不匹配造成的。 底层连接已关闭:发送时发生意外错误。 由于数据包格式意外,握手失败。 如果当前解决方案中定义了该服务,请尝试构建该解决方案并再次添加服务引用。

<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="True" multipleSiteBindingsEnabled="false"/>
<services>
  <service name="Project.Services.NotificationService"
           behaviorConfiguration="notificationservicebehavior">
    <endpoint name="basicHttpBinding"
              contract="Project.Services.INotificationService"
              address="http://127.0.0.1:443/NotificationService.svc"
              binding="basicHttpBinding"
              />
  </service>
</services>

<behaviors>
  <serviceBehaviors>
    <behavior name="notificationservicebehavior">
      <serviceMetadata httpGetEnabled="true" httpGetUrl="" />
    </behavior>
    <behavior name="">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
  </serviceBehaviors>
</behaviors>

最佳答案

如果您使用的是自签名证书或不是来自 these authorities 的证书您需要在设备上安装它。

只有两种方法可以在设备上安装第三方证书,目前都无法通过代码完成:

Installing certificates via Windows® Internet Explorer®
A certificate can be posted on a website and made available to users through a device-accessible URL that they can use to download the certificate. When a user accesses the page and taps the certificate, it opens on the device. The user can inspect the certificate, and if they choose to continue the certificate is installed on the device.

Installing certificates via email
The certificate installer on Windows Phone 7 supports .cer, .p7b, and .pfx files. When installing certificates via email, make sure your mail filters do not block .cer files. Certificates that are sent via email appear as message attachments. When a certificate is received, a user can tap to review the contents and then tap to install the certificate. Typically, when an identity certificate is installed the user is prompted for the passphrase that protects it.

您必须让用户执行其中一项操作,应用程序才能使用证书。

来自Windows Phone 7 and Certificates_FINAL_121610.pdf

关于asp.net - 无法正确添加服务引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6073322/

相关文章:

javascript - 将 MVC 模型序列化为 JSON

javascript - 如何禁用javascript确认框服务器端验证错误按钮提交事件?

c# - 在哪里将 ViewModel 绑定(bind)到 View?

c#-4.0 - 如何订阅 IObservable,但缓冲其中的数据,直到另一个 IObservable 发布?

c#-4.0 - 限制 GUID 中的字符数

asp.net - 禁止接收 "Path ' OPTIONS。ASP.NET 网站出现异常

asp.net - 如何使用表单例份验证将用户重定向到密码恢复页面

windows-phone-7 - 在 XNA 中使用 Windows Phone 7 捏合

c# - "Rate It"Windows Phone 市场链接

.net - C# Unicode 字符串输出