0

I had a webservice which i was directly accessing from my webform. I used a service reference in my wesite and used a serviceclient on my webform which worked fine.

Now i removed the service reference from my website and created a class library hich consumes this webservice the same way usinfg a service reference and service client in the class.

when i try to use this class library now it gives me an error that no default endpoint found for the contract. Also i had changed the namespace of my class library and also changed it in settings and assembly files. the dll still has the old name :( I've added a reference of this class library in my website.

where am i going wrong.

4

2 回答 2

0

服务引用仍然需要添加到 webform 项目中,因为客户端使用web.config正在运行的项目中的设置进行连接,而不是类库。

于 2011-02-23T15:17:17.660 回答
0

如果将 WCF 服务引用放入类库中,那么您将获得一个 app.config,其中包含在该类库中创建的绑定信息。不幸的是,当您引用该库时,不会加载该配置信息。

您需要将类库中的 app.config 部分复制到主应用程序的配置区域。这将使它在调用服务时可用。

于 2011-02-23T15:48:40.640 回答