通过config指定WCF服务的运行时地址
我已经使用VS2010 C#创建了一个WCF库,从其他项目引用它,在设计时工作正常。 但在运行时,据我了解,它使用不同的地址。 那么,我该如何指定它?
我的App.Config如下所示:
<system.web>
<compilation debug="true" />
</system.web>
<system.serviceModel>
<services>
<service name="WcfService.Service1">
<host>
<baseAddresses>
<add baseAddress = "http://localhost:8732/Design_Time_Addresses/WcfService/MyWcf/" />
</baseAddresses>
</host>
<endpoint address ="" binding="wsHttpBinding" contract="WcfService.IService1">
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
链接地址: http://www.djcxy.com/p/95883.html