Just wasted two hours on one of those difficult to spot typos [modified]
-
Had this
using (ServiceHost host = new ServiceHost(typeof(CalculatorService.Calculator), new Uri("net.pipe://localhost/CalculatorService")))
{
host.AddServiceEndpoint(typeof(CalculatorService.Calculator), new NetNamedPipeBinding(), "Calculator");
host.Open();
Console.WriteLine("Press to terminate the service host");
Console.ReadLine();
}Kept on getting missing ServiceContract attribute error. I kept on comparing it with a structurally similar app. that worked fine. In the end I had to copy and paste this other app. into mine and then make mine look as similar as possible. Then I finally spotted the typo! :-O :wtf:
using (ServiceHost host = new ServiceHost(typeof(CalculatorService.Calculator), new Uri("net.pipe://localhost/CalculatorService")))
{
host.AddServiceEndpoint(typeof(CalculatorService.ICalculator), new NetNamedPipeBinding(), "Calculator");
host.Open();
Console.WriteLine("Press to terminate the service host");
Console.ReadLine();
}The second typeof should have read CalculatorService.ICalculator not CalculatorService.Calculator. Of course, if I'd have been at work, a co-worker would most likely have spotted this.
Kevin
modified on Monday, October 20, 2008 1:09 PM
-
Had this
using (ServiceHost host = new ServiceHost(typeof(CalculatorService.Calculator), new Uri("net.pipe://localhost/CalculatorService")))
{
host.AddServiceEndpoint(typeof(CalculatorService.Calculator), new NetNamedPipeBinding(), "Calculator");
host.Open();
Console.WriteLine("Press to terminate the service host");
Console.ReadLine();
}Kept on getting missing ServiceContract attribute error. I kept on comparing it with a structurally similar app. that worked fine. In the end I had to copy and paste this other app. into mine and then make mine look as similar as possible. Then I finally spotted the typo! :-O :wtf:
using (ServiceHost host = new ServiceHost(typeof(CalculatorService.Calculator), new Uri("net.pipe://localhost/CalculatorService")))
{
host.AddServiceEndpoint(typeof(CalculatorService.ICalculator), new NetNamedPipeBinding(), "Calculator");
host.Open();
Console.WriteLine("Press to terminate the service host");
Console.ReadLine();
}The second typeof should have read CalculatorService.ICalculator not CalculatorService.Calculator. Of course, if I'd have been at work, a co-worker would most likely have spotted this.
Kevin
modified on Monday, October 20, 2008 1:09 PM
Well...of course....doesn't every programmer know that the easiest way to find embarrassingly simple errors is to show your code to someone else? ;) If you're lucky, the very act of asking for a fresh pair of eyes will make YOU see the problem, in which case you can quickly say 'Oh nevermind, its ok...' and pretend you didn't just spend hours going on all sorts of wild-goose debugging escapades in order to find a typo.... :rolleyes:
-
Well...of course....doesn't every programmer know that the easiest way to find embarrassingly simple errors is to show your code to someone else? ;) If you're lucky, the very act of asking for a fresh pair of eyes will make YOU see the problem, in which case you can quickly say 'Oh nevermind, its ok...' and pretend you didn't just spend hours going on all sorts of wild-goose debugging escapades in order to find a typo.... :rolleyes:
Kyudos wrote:
the very act of asking for a fresh pair of eyes will make YOU see the problem
Yep. Happens all the time. :)
Kevin
-
Had this
using (ServiceHost host = new ServiceHost(typeof(CalculatorService.Calculator), new Uri("net.pipe://localhost/CalculatorService")))
{
host.AddServiceEndpoint(typeof(CalculatorService.Calculator), new NetNamedPipeBinding(), "Calculator");
host.Open();
Console.WriteLine("Press to terminate the service host");
Console.ReadLine();
}Kept on getting missing ServiceContract attribute error. I kept on comparing it with a structurally similar app. that worked fine. In the end I had to copy and paste this other app. into mine and then make mine look as similar as possible. Then I finally spotted the typo! :-O :wtf:
using (ServiceHost host = new ServiceHost(typeof(CalculatorService.Calculator), new Uri("net.pipe://localhost/CalculatorService")))
{
host.AddServiceEndpoint(typeof(CalculatorService.ICalculator), new NetNamedPipeBinding(), "Calculator");
host.Open();
Console.WriteLine("Press to terminate the service host");
Console.ReadLine();
}The second typeof should have read CalculatorService.ICalculator not CalculatorService.Calculator. Of course, if I'd have been at work, a co-worker would most likely have spotted this.
Kevin
modified on Monday, October 20, 2008 1:09 PM
Kevin McFarlane wrote:
Of course, if I'd have been at work, a co-worker would most likely have spotted this.
Yeah, sometimes it is rough being on your own. I am the ONLY .net programmer at my company. On bigger projects I work with consultants but 95% of the time, I am on my own.
I didn't get any requirements for the signature