【发布时间】:2017-04-27 06:37:29
【问题描述】:
在我的 .Net Core 应用程序中,我正在使用 Web 服务 添加 -> 连接的服务 -> WCF 服务预览(nuget 包)并添加 Web 服务并使用服务方法。
但是,现在客户将 Web 服务移至内部 Web 服务器,我无法从我的开发环境访问该服务。所以我无法访问服务方法并构建我的解决方案并发布。
有什么方法可以从配置文件传递服务 URL?
示例:
对于开发环境 - http://dev.svc
对于 Prod 环境 - http://prod.svc
【问题讨论】:
-
Is there any way that I can give the Web Service URL from Configuration file as I do not have access to the service from my development environment。你在问什么? -
您可以为每个环境的不同值使用配置转换msdn.microsoft.com/en-us/library/dd465326(v=vs.110).aspx
-
感谢@ColinM 的回复我正在使用.Net Core,我想它会有所不同
-
我需要更改 Reference.cs 中的任何内容吗?
标签: wcf asp.net-core .net-core asp.net-core-webapi