I bought a book to help me learning WCF. Lots of people complained that the book was written for VS 2005 at first then there was a reprinting for VS 2008. What it seems is that the code for VS 2005 would not work in VS 2008. I'm wondering why? What is more likely the solution files or the code itself?

I know that code gets deprecated (methods and even whole classes). I"m wondering what are the chances that what i learn in the book from 2008 will work in VS 2010. I assume that I shouldn't have to RE-LEARN WCF for each version of Visual Studio.

I wanted to get some thoughts on this before i spend time learning something I can't use. Thanks!

I assume that I shouldn't have to RE-LEARN WCF for each version of Visual Studio.

I agree... it shouldn't be that different. And it hasn't been, in my experience.

What it seems is that the code for VS 2005 would not work in VS 2008. I'm wondering why?

So are we. What does "not work" mean? Does your code fail to build, or just behave badly? Can you provide specific error messages?

Thanks very much! no errors yet. Some people on Amazon said they were getting errors before the book update.

I was just trying to make sure there wasn't a difference in the code from VS 2008 and VS 2010.

Ah, ok. For basic WCF services, you shouldn't notice anything different. We've got a number of WCF services at my day job, where we've transitioned from VS 2005 to 2008 to 2012, and I haven't noticed or heard of any problems.

THanks I appreciate teh information

Well looks like I should have started coding before letting you know I wasn't getting errors.

The author told us to add an Empty solution. So i did. I'm using VS2010. Then Add a Class Library. So I did. While I'm not getting squiggly lines, it does not recognize using System.ServiceModel;. When i compile i get the error messages down below even though it doesn't do squiggly lines.

This is all the code I have. I assume the author is using the wrong library maybe? I followed the instructions.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;

namespace HelloIndigo
{
    [ServiceContract(Namespace = " http://www.thatindigogirl.com/samples/2006/06")]
    public interface IHelloIndigoService 
    {
        [OperationContract]
        string HelloIndigo();
    }

    public class HelloIndigoService : IHelloIndigoService
    {
        public string HelloIndigo()
        {
            return "Hello Indigo";
        }
    }
}

I get these errors:

Error 1 Program 'c:\users\documents\visual studio 2010\projects\ServiceFromScratch\ServiceFromScratch\obj\x86\Debug\ServiceFromScratch.exe' does not contain a static 'Main' method suitable for an entry point ServiceFromScratch

Error 2 The type or namespace name 'ServiceModel' does not exist in the namespace 'System' (are you missing an assembly reference?) c:\users\documents\visual studio 2010\projects\ServiceFromScratch\HelloIndigo\Service.cs 5 14 HelloIndigo

Error 4 The type or namespace name 'ServiceContractAttribute' could not be found (are you missing a using directive or an assembly reference?) c:\users\keoki stevenson\documents\visual studio 2010\projects\ServiceFromScratch\HelloIndigo\Service.cs 11 6 HelloIndigo

Thanks!

You are missing a reference in your solution. Right click the 'references' in your project explorer, select add, .NET tab and System.ServiceModel. You may have to add other the the ServiceModel references as you start using their classes.

I tried converting the file to VS 2010 and the app still doesn't work. I don't get the errors anymore but it crashes. I'm going to reinstall VS 2008 tomorrow and see what happens.

Momerath, that seems to have solved some of it. it is still asking for a Main(). I'll try to follow the next steps to see if that gets cleared up with the console being added.

OK i'm getting this error:

HTTP could not register URL http://+:8000/HelloIndigo/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details).

It is crashing on host.Open();

The code in the console project looks like this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;

namespace Host
{
    class Program
    {
        static void Main(string[] args) 
        { 
            using (ServiceHost host = new ServiceHost(typeof(HelloIndigo.HelloIndigoService), new Uri("http://localhost:808/HelloIndigo"))) 
            { 
                host.AddServiceEndpoint(typeof(HelloIndigo.IHelloIndigoService), new BasicHttpBinding(), "HelloIndigoService"); 
               ** host.Open(); **
                Console.WriteLine("Press < ENTER > to terminate the service host"); Console.ReadLine(); 
            } 
        }

    }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.