【发布时间】:2012-07-02 19:38:00
【问题描述】:
我有一个 Silverlight 5 应用程序,它从另一个项目中的启用 Silverlight 的 WCF 服务获取数据(我的解决方案有一个 Silverlight 项目和一个 Web 项目)。有许多类似的帖子,但它们指的是托管在 Web 服务器上的 Web 服务(正确的 Web 服务)。
我知道我必须告诉应用程序在 dev 和 prod 中哪里可以找到服务。在开发中,您通常会有一个端口。我创建服务客户端的代码(使用正确的 EndpointAddress)如下:
BasicHttpBinding binding = new BasicHttpBinding(
Application.Current.Host.Source.Scheme.Equals("https", StringComparison.InvariantCultureIgnoreCase)
? BasicHttpSecurityMode.Transport : BasicHttpSecurityMode.None);
binding.MaxReceivedMessageSize = int.MaxValue;
binding.MaxBufferSize = int.MaxValue;
Uri tempUri = new Uri("../PolicyDataService.svc", UriKind.Relative);
EndpointAddress servAddr = new EndpointAddress(tempUri);
PolicyDataServiceClient temp = new PolicyDataServiceClient("BasicHttpBinding_PolicyDataService", servAddr);
return temp;
现在,我哪里出错了?在 dev 中,一切正常,但在 prod 中,该服务永远不会被调用。谢谢!
【问题讨论】:
标签: wcf silverlight web-services