Web Service/Web Config Issues

给你一囗甜甜゛ 提交于 2019-12-13 05:15:38

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!