I am working on a WCF application that will be deployed to different servers along the way, and I would not forget to change app.config every time I deploy it. At first, my app.config serviceModel section looked like this:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false" />
<behaviors>
<serviceBehaviors>
<behavior name="MyDefaultServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpGetUrl="http://localhost:8888/MyService" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="MyDefaultServiceBehavior" name="MyService">
<endpoint address="net.tcp://localhost:9001/MyService" binding="netTcpBinding" contract="IMyService" name="NetTcpBinding_IMyService" />
</service>
</services>
This works fine during the development process when I accessed a service running on my local machine. When I deployed it, the WSDL contained absolute paths that still pointed to localhost:
<xsd:import schemaLocation=http://localhost:8888/MyService?xsd=xsd0 namespace="http://tempuri.org/" />
So, I can change httpGetUrl in app.config like this:
<serviceMetadata httpGetEnabled="true" httpGetUrl=http://devserver1:8888/MyService />
And now wsdl works correctly on this server. The problem is that I have to manually set the address in every app.config that is deployed.
:
1. wsdl , ?
2. wsdl?
. , , wsdl.
-, , - , , -.
!
Daniel