configure serivce.clientconfig for Silverlight project
来源:互联网 发布:sql server是数据库吗 编辑:程序博客网 时间:2024/06/08 09:10
In Silverlight project, when you use WCF service, there will be a ServiceReference.ClientConfig file with the service configure info, but as you know, when Silverlight projects been build, all code will be packaged in a .xap file, as well as the ServiceReference.ClientConfig file. Damned, how can I modify the service address since I want to deploy the solution in a different server? Or can I gain the runtime configuring benefit? To be more configurable, you can have two methods:
-
- Use App.Current.Host.Source to get the Xap file Uri(http://localhost:60978/ClientBin/ReportInSl.xap) , then, combine with the relative path of the service to get the service Uri(new Uri(App.Current.Host.Source,"../../DataServices/GetReportData.svc"));
- Change the serviceReference.ClientConfig, to use the relative Uri in the client, shown as below:
As Is
To Be
<configuration>
<system.serviceModel>
<client>
<endpoint address="http://localhost:60978/DataServices/GetReportData.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IGetReportData"
contract="ReportDataService.IGetReportData" name="BasicHttpBinding_IGetReportData" />
</client>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IGetReportData" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
</configuration>
<configuration>
<system.serviceModel>
<client>
<endpoint address="/DataServices/GetReportData.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IGetReportData"
contract="ReportDataService.IGetReportData" name="BasicHttpBinding_IGetReportData" />
</client>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IGetReportData" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
</configuration>
- configure serivce.clientconfig for Silverlight project
- Silverlight中的ServiceReferences.ClientConfig
- [Silverlight]摆脱对 ServiceReferences.ClientConfig 的依赖
- [Silverlight]摆脱对 ServiceReferences.ClientConfig 的依赖
- Silverlight摆脱对 ServiceReferences.ClientConfig 的依赖
- Apply for Google FCM ( Firebase Cloud Message ) Project & Configure Android Project
- 无法识别的元素“extendedProtectionPolicy” win7 windows2003 silverlight app.config ServiceReferences.ClientConfig
- Silverlight Project开发
- 创建一个Silverlight Project
- configure boost for ubuntu
- Configure TLS for Opensips
- Configure CDB for QtCreator
- Configure Eclipse for stm32
- Silverlight touch_1 -- create a simple silverlight project
- Android Serivce
- Myeclipse Configure-->Convert to Maven Project
- ServiceReferences.ClientConfig错误
- Configure Apache for multiple projects
- Windows Logon Type的含义
- CEGUI安装、编译、运行总结
- SQL Server(更改所有者、数据库恢复)
- 从MDF文件恢复SqlServer数据库
- linux的物理内存与线性地址空间布局--1
- configure serivce.clientconfig for Silverlight project
- 工作与刻意练习
- 三种不同的接口实现方式
- win7下jdk安装环境变量配置
- Symbian下ini文件操作
- 使用 cat、ed 和 sed 的快速编辑示例
- [Sql]inner join 和where 区别
- ubuntu9.04安装tomcat及自启动
- 关于go语言