我们从第三方继承了一些使用外部服务器上的web服务的代码。目前,所有的引用都是在项目中直接完成的,因此编译到该位置等。我们遇到的问题是,web服务有一个测试和生产服务器,具有不同的url。
你可以把网址放在 appSettings web.config
appSettings
web.config
<appSettings> <add key="wsUrl" value="http://example.com/staging.asmx" /> </appSettings>
Url 属性:
public SomeProxy() { Url = ConfigurationManager.AppSettings["wsUrl"]; }