using this example...Hosting WCF service inside a Windows Forms application ... with a Winform Application in 4.5 VS2012 in the form_Load() it loads okay but can not access in Browser ... error can not access 'localhost'
private ServiceHost Host;
private void frmAdmin_Load(object sender, EventArgs e)
{
Host = new ServiceHost(typeof(bklvmain_v4.BTestService));
if (Host == null)
Host.Open();
}
private void closeToolStripMenuItem_Click(object sender, EventArgs e)
{
if (Host != null)
Host.Close();
}
App config...
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="bklvmain_v4.BTestServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="bklvmain_v4.BTestServiceBehavior"
name="bklvmain_v4.BTestService">
<endpoint address="" binding="wsHttpBinding" contract="bklvmain_v4.IBTestService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost/BTestService/" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
interface...
[ServiceContract]
public interface IBTestService
{
[OperationContract]
Tickers[] BTestLong(string dte);
[OperationContract]
Tickers[] BTestShort(string dte);
}