C# WCF URI连接

C# WCF URI连接,c#,wcf,C#,Wcf,我正在尝试WCF,但我的连接有问题。这是我的密码 接口 using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel; using System.Text; namespace Service { [ServiceContract(Namespace = "")] public interface IOperatio

我正在尝试WCF,但我的连接有问题。这是我的密码

接口

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

    namespace Service
    {
        [ServiceContract(Namespace = "")]
        public interface IOperation
        {
            [OperationContract]
            string HelloWorld();
        }
    }
实施

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

namespace Service
{
    class ImplOperation : IOperation
    {
        public string HelloWorld()
        {
            return "Hello world";
        }
    }
}
主机服务

using System;
using System.ServiceModel;
using System.ServiceModel.Description;

namespace Service
{
    class Program
    {
        static void Main(string[] args)
        {
            Uri baseAddress = new Uri("Http://localhost:8000/Service");

            using (ServiceHost sHost = new ServiceHost(typeof(ImplOperation),baseAddress))
            {
                try
                {
                    sHost.AddServiceEndpoint(typeof (IOperation), new WSHttpBinding(), "ImplOperation");
                    ServiceMetadataBehavior sBehaviour = new ServiceMetadataBehavior() {HttpGetEnabled = true};
                    sHost.Description.Behaviors.Add(sBehaviour);

                    sHost.Open();
                    Console.WriteLine("Service started");
                    Console.WriteLine("press <Enter> to close");
                    Console.ReadLine();
                    sHost.Close();
                }catch(Exception exception)
                {
                    Console.WriteLine("Exception:\t {0}",exception.Message);
                    sHost.Abort();
                }
            }
        }
    }
}

当我创建Uri实例时,Uri name=service是可选的,所以它是否必须与namesapce name相同,或者我可以写入任何内容,当我添加serviceEndpoint时,该名称“ImplOperation”如何,我可以在那里写入任何内容?

当您将浏览器指向:?尝试在上运行svcuti,而不是
    c:\Users\lakpa\My Documents\visual studio 2010\Projects\WcfConsoleService\Client
>svcutil.exe /language:cs /out:GeneratedProxy.cs /config:app.config Http://local
host:8000/Service/ImplOperation

HTTP GET Error
    URI: http://localhost:8000/Service/ImplOperation

    There was an error downloading 'http://localhost:8000/Service/ImplOperation'
.

    The request failed with HTTP status 400: Bad Request.

If you would like more help, type "svcutil /?"