我新建了一个wcf服务
    [ServiceContract]
    public interface IService1
    {
        [WebGet(UriTemplate = "/GetString")]
        [OperationContract]
        string GetString();
        // TODO: 在此添加您的服务操作
    }    public class Service1 : IService1
    {        public string GetString()
        {
            return "Hello world";
        }
    }在vs2010里面直接右键 在浏览器查看 Service1.svc我怎么才可以运行http://localhost:11301/Service1.svc/GetString现在运行http://localhost:11301/Service1.svc/GetString返回400啊 是不是web config要配置啊

解决方案 »

  1.   

    http://wcftutorial.net/WCF-Self-Hosting.aspxwcf自承载,也就是在自己的应用程序中承载wcf服务。
    要点是创建一个ServiceHost对象,并且让它承载服务。
      

  2.   

    麻烦你找个wcf的例子看下 
      

  3.   

    可以使用WCF Test Client (WcfTestClient.exe)测试WCF。 路径
    C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\其中Microsoft Visual Studio 9.0取决于版本参考:
    http://msdn.microsoft.com/en-us/library/bb552364.aspx