这可以在appconfig文件中使用吗?
<add key="@IPAddress" value="http://00.00.00.00:0000"/>
替换这个:
<endpoint address="http://00.00.00.00:0000/some/something"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding"
用这个:
<endpoint address="@IPaddress/some/something"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding"
答案 0 :(得分:0)
你无法在配置中执行此操作。但是你可以在运行时更改你的地址,比如
var confAddress=ConfigurationManager.AppSettings["IPAddress"];
string address = confAddress+"/some/something";
using (ServiceHost serviceHost = new ServiceHost(typeof(yourContract), address))
{
//Consume your service
}