简体   繁体   中英

Service reference works for windows form but doesn't work for class library

I have two applications. One of them is a windows forms application and other one is a web application which use a class library. I use a web service(WCF). When I give this web service as service reference to my windows form application everything is fine. But when I give it as service reference to class library, I have this error ' No connection could be made because the target machine actively refused it ... '

I give the reference as the same way to these two projects. What should I do?

By default, you cannot configure your WCF service through a configuration file coming from your class library.

Add a web.config with the proper WCF configuration (similar to the one in the app.config of your winforms project) in your web application assembly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM