Это в WCF сервис мой Web.config
:Невозможно добавить конечную точку WCF службы в WinForms
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service name="Mobile55.Service1">
<endpoint address="../Service1.svc"
binding="webHttpBinding"
contract="Mobile55.IService1"
behaviorConfiguration="webBehaviour" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="webBehaviour">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="Content-Type, Accept" />
</customHeaders>
</httpProtocol>
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
Это первый раз, когда я работаю с WCF, и я не могу добавить конечную точку для этого сервиса в моем приложении WinForms.
Я добавил эту услугу в качестве ссылки, и я могу получить доступ к методам, но когда я отладка и попытаться вызвать метод он бросает исключение:
Could not find default endpoint element that references contract 'MyService.IService1' 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.
Моего файл приложение app.config
пуст.
Я попытался следующие ответы, но не работает для меня:
Could not find default endpoint element
Could not find default endpoint element that references contract - Hosting wcf
Как добавить конечную точку, чтобы, наконец, быть в состоянии использовать свой оказание услуг?
Заранее спасибо.
EDIT: Мой app.config
файл:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
<service name="Mobile55.Service1">
<endpoint address=""
binding="webHttpBinding"
contract="Mobile55.IService1"
behaviorConfiguration="webBehaviour" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="webBehaviour">
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<client>
<endpoint address="http://localhost:1008/Service1.svc"
binding="webHttpBinding"
contract="Mobile55.IService1"
behaviorConfiguration="webBehaviour" />
</client>
</system.serviceModel>
</configuration>
спасибо. Но после добавления этого раздела теперь я получаю следующее: «Нет никакого поведения конечной точки с именем« webBehaviour » –
Вы действительно _add_ элемент' client' в свой раздел 'system.serviceModel', или вы заменили весь раздел тем, что Я написал? –
Я добавил свой контент app.config выше.Вы можете взглянуть? –