问题
So I get thrown an exception right when I try to create a new instance of my Web Service that says:
"Could not find default endpoint element that references contract 'KBBVehicleService.IVehicleInformationService' 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."
This is a web service that will connect to Kelley Blue Book.
I know I need a new endpoint entry in my Web.Config, but what does this look like?
The one I added looks like this:
<endpoint address="http://localhost:3300/KBB.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Default" contract="Services.Client.IVehicleInformationService"/>
But it doesn't work. Still throws the same exception at the same place.
Any ideas?
回答1:
As the exception message suggest you, use the proper contract type:
<endpoint
address="http://localhost:3300/KBB.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_Default"
contract="KBBVehicleService.IVehicleInformationService"
/>
回答2:
Could not find default endpoint element that references contract 'ServiceReference.IWebService' 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.
来源:https://stackoverflow.com/questions/3630316/web-service-web-config-issues