过去几个小时我已经阅读了很多线程,但我没有找到适合我的解决方案:-(
因此,作为已经有多个其他用户,我在从我的 Windows Phone 7 应用程序中通过 SSL 调用 SVC-Webservice 时遇到问题。在本地主机上它工作正常。我已经在我的 Web 应用程序中部署了 Web 服务。服务“MyService.svc”位于 Web 应用程序的根目录中。在 IIS 上,我只为此 IP 添加了 HTTPS(来自 Startcom,使用默认端口 443)并要求使用 SSL。我可以打开我的 Web 应用程序,我可以使用http://mydomain.com/MyService.svc上的任何浏览器从服务器和本地开发机器上打开 Web 服务。该页面说我可以调用 svcutil.exe https://mydomain.com/MyService.svc?wsdl。当我单击链接时,数据显示正确。
现在,当我尝试通过 WP7 应用程序访问它时,我总是收到以下错误: “在https://mydomain.com/MyService.svc上没有可以接受消息的端点监听。这通常是由不正确的地址或SOAP 操作。有关详细信息,请参阅 InnerException(如果存在)。 内部细节说:“远程服务器返回错误:NotFound。” 这是我的 web.config 的重要部分。我不知道这是否都是必需的,因为我已经从多个线程中复制了它,但至少在 IE 中它可以正常工作:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="MyBehavior">
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="1073741824" />
<useRequestHeadersForMetadataAddress>
<defaultPorts>
<add scheme="https" port="443" />
</defaultPorts>
</useRequestHeadersForMetadataAddress>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="MyBehavior" name="MyNamespace.MyService">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="HttpsBinding"
contract="MyNamespace.IMyService">
</endpoint>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="HttpsBinding">
<readerQuotas maxStringContentLength="2147483647" />
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<!-- <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> -->
非常感谢!