我有一个Windows服务,我试图在远程webservice下调用一个方法,但是我收到错误“无法在ServiceModel客户端配置部分找到引用契约'MyWebService.BookingCitySoap'的默认端点元素。这可能因为没有为您的应用程序找到配置文件,或者因为在客户端元素中找不到与此合同匹配的端点元素。“
以下是该
的代码.cs文件
MyWebService.BookingCitySoapClient ws = new MyWebService.BookingCitySoapClient();
ws.CallBookStatus();
ws.CallCanStatus();
的App.config
<bindings>
<basicHttpBinding>
<binding name="BookingCitySoap" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:51317/Web/BookingCity.asmx"
binding="basicHttpBinding" bindingConfiguration="BookingCitySoap"
contract="MyWebService.BookingCitySoap" name="BookingCitySoap" />
</client>