Going straight to the point, I have a WCF project and Host project(which I want to launch Service), when I make the WCF as a startUp project, it hosts the service, I receive a confirmation message(bottom right) and everything works fine, but when I try to host from the Host project, it does not host, no confirmation message anything.
Here is my Host code:
static void Main(string[] args)
{
using (ServiceHost host = new ServiceHost(typeof(MovieService)))
{
host.Open();
Console.WriteLine("The host is online.");
Console.ReadLine();
host.Close();
}
}
Host app.config:
<system.serviceModel>
<services>
<service name="CinemaProject.WCF.MovieService">
<endpoint address="" binding="wsHttpBinding" contract="CinemaProject.WCF.IMovieService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/Design_Time_Addresses/CinemaProject.WCF/MovieService/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True" />
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
And my WCF code:
public class MovieService : IMovieService
{
static MovieCtr movieCtr = new MovieCtr();
public void Add(Movie movie)
{
movieCtr.add(movie);
}
public void SearchById(int id)
{
}
public void Update(Movie movie)
{
}
public void Delete(Movie movie)
{
}
public void DeleteById(int id)
{
}
public IEnumerable<MovieDTO> All()
{
return movieCtr.All();
}
}
And WCF app.config:
<system.serviceModel>
<services>
<service name="CinemaProject.WCF.MovieService">
<endpoint address="" binding="wsHttpBinding" contract="CinemaProject.WCF.IMovieService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/Design_Time_Addresses/CinemaProject.WCF/MovieService/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True" />
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
Can somebody look at it and point me in the right direction, and post a solution aswell if possible.
Thank you, Marius J.