简体   繁体   中英

Why can't my test client connect to my WCF rest service?

I have a simple wcf rest service. I can test it ok using the WCF Test Client.

I created a test client of my own via svcutil.exe. This builds and runs. However, it always gives this exception when instantiating the service object:

Could not find default endpoint element that references contract 'IBookService' 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.

I'm basically following the tutorial here: http://www.codeproject.com/Articles/571813/A-Beginners-Tutorial-on-Creating-WCF-REST-Services

I also cannot access the endpoints via a url when running it locally. It's unclear to me why this tutorial has a .svc file in the url when trying to access the service from a browser though. I have no .svc files anywhere.

The WCF Test Client is for testing SOAP -based services (those services using any binding other than webHttpBinding in WCF).

The WCF Test Client however is NOT capable of working with REST services.

For REST , use something like Fiddler instead.

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