I am adding SVC file as an service reference to the application, 开发者_运维知识库then created proxy of it. When I debug the service reference I am getting the following error
System.InvalidOperationException was caught Message=Could not find endpoint element with name 'SoapHttpEndPoint' and contract 'SNP.SnpCatalogService' 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 name could be found in the client element.
written the following code
ServiceReference1.SnpCatalogServiceClient obj = new ServiceReference1.SnpCatalogServiceClient();
At this point I am getting the above error.
Config section generated by WCF is
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="SoapHttpEndPoint" 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>
<netTcpBinding>
<binding name="SoapNetTcpEndPoint" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false"
transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="10"
maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10"
maxReceivedMessageSize="65536">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="None">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
<message clientCredentialType="Windows" />
</security>
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="svc address"
binding="basicHttpBinding" bindingConfiguration="SoapHttpEndPoint"
contract="SnpCatalogService" name="SoapHttpEndPoint" />
<endpoint address="svc address"
binding="netTcpBinding" bindingConfiguration="SoapNetTcpEndPoint"
contract="SnpCatalogService" name="SoapNetTcpEndPoint" />
</client>
</system.serviceModel>
</configuration>
精彩评论