我在 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.
您必须让用户执行其中一项操作,应用程序才能使用证书。
关于asp.net - 无法正确添加服务引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6073322/