I have a Winforms application that talks to a WCF service. When run, it works.
However, when you load a form that has a dependency on one of the datatypes in the service, it fails. In fact, it then crashes VS2017 and VS2015, making it tougher.
The error, if I can catch it before VS restarts, is that the client configuration for the endpoint is wrong. Yet it does work when you press F5 and run the app! I'm hoping that if I post the servicemodel sections of the service and the app someone will be able to spot the misconfiguration:
In the service library's app.config I have:
<system.serviceModel>
<services>
<service name="SapphireServiceLib.SapphireService"
behaviorConfiguration="SoapToRESTfullDemo.Service1Behavior">
<endpoint address=""
binding="wsHttpBinding"
contract="SapphireServiceLib.ISapphireService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8888/sapphireservice" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="SoapToRESTfullDemo.Service1Behavior">
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="True"/>
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
...and in the EXE's app.config I have the following:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_ISapphireService" />
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8888/sapphireservice"
binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_ISapphireService"
contract="SapphireServiceReference.ISapphireService"
name="WSHttpBinding_ISapphireService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
Can anyone spot anything obvious? Clearly the VS designer needs to be able to connect to the endpoint at design time to access the classes that it needs for the form, but that endpoint connection is only working at runtime, not at design time.