首页 新闻 会员 周边

wcf配置问题

0
悬赏园豆:10 [已关闭问题] 关闭于 2013-10-22 23:01

为什么访问http://localhost:8182/DoWork是400错误,但是在另一个项目中“添加服务引用”,输入http://localhost:8182/能访问到,然后我把app.config里面的wcf配置去掉,就能访问了,但那是添加服务引用就访问不到了

wcf
问题补充:
[ServiceContract]
    public interface IService1
    {
        [OperationContract]
        [WebGet(ResponseFormat = WebMessageFormat.Json)]
        string DoWork();
    }

 [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
    public class Service1 : IService1
    {
        public string DoWork()
        {
            Console.WriteLine(0);
            return "1";
        }
    }

 static void Main(string[] args)
        {
            WebServiceHost host = new WebServiceHost(typeof(Service1), new Uri("http://localhost:8182/"));
            host.Open();

            while (true)
            {
                Console.ReadLine();
            }
        }

 

代码如下:

拖鞋王子的主页 拖鞋王子 | 初学一级 | 园豆:37
提问于:2013-05-29 14:00
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册