我有一个从类库引用的WCF Web服务.在项目运行之后,当从类库中创建服务客户端对象时,我收到带有消息的InvalidOperationException:
Could not find default endpoint element that references contract
‘MyServiceReference.IMyService’ 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.
我用来创建实例的代码是:
myServiceClient = new MyServiceClient();
MyServiceClient继承自的地方
System.ServiceModel.ClientBase
我该如何解决这个问题?
注意:我有一个单独的控制台应用程序,它只是创建相同的服务对象并调用它,它没有任何问题.