本人用VS2008(C#)新建了一个windows forms control library程序 并添加了service引用,编译通过,但调试运行的时候出错了: 
“Could not find default endpoint element that references contract 'ServiceReference1.Service1Soap' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element. ”service引用:web service application 和 wcf service application 都试用过均是同样的错误。private ServiceReference1.Service1SoapClient dataset_client= new ServiceReference1.Service1SoapClient();//web service 
private ServiceReference1.Service1Client dataset_client = new ServiceReference1.Service1Client();//WCF创建服务对象(客户端与服务端的接口);程序很简单在此就不附加代码了(代码应该没有错误,在winform 应用程序上可以运行),有兴趣的大虾们可以自己建立程序试验一下,我相信会出现同样的错误此外我也将 windows forms control library 作为控件添加到 winform应用程序上运行也是出错,实在搞不懂是什么原因!
小弟分不多了,见谅!

解决方案 »

  1.   

    http://social.msdn.microsoft.com/forums/en-US/wcf/thread/ff75bef1-6c9f-431c-9326-f45206fccfde/
      

  2.   

    VS2008下确实有可能出问题,添加引用的时候,注意有个高级的地方,查查这个资料,你就知道了,我有点记不清了,应该是在这里改动,VS2008里的WebService和VS2005里WebService还是有区别的。
      

  3.   

    补充一下:我创建的是个winform动态库程序,如果是winform应用程序的话引用web服务是正确的。