Asp.net wcf服务引用错误

Asp.net wcf服务引用错误,asp.net,wcf,Asp.net,Wcf,我将SVC文件作为服务引用添加到应用程序中,然后创建它的代理。 当我调试服务引用时,我得到以下错误 捕获System.InvalidOperationException消息=找不到 名为“SoapHttpEndPoint”和协定的endpoint元素 ServiceModel客户端配置中的“SNP.SnpCatalogService” 节。这可能是因为找不到的配置文件 您的应用程序,或者因为没有与此名称匹配的端点元素 可以在客户端元素中找到 编写了以下代码 ServiceReference1.S

我将SVC文件作为服务引用添加到应用程序中,然后创建它的代理。 当我调试服务引用时,我得到以下错误

捕获System.InvalidOperationException消息=找不到 名为“SoapHttpEndPoint”和协定的endpoint元素 ServiceModel客户端配置中的“SNP.SnpCatalogService” 节。这可能是因为找不到的配置文件 您的应用程序,或者因为没有与此名称匹配的端点元素 可以在客户端元素中找到

编写了以下代码

ServiceReference1.SnpCatalogServiceClient obj = new ServiceReference1.SnpCatalogServiceClient();
在这一点上,我得到了上面的错误

WCF生成的配置节是

<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>


发布VS生成的wcf配置部分。在您的代码片段中检查SoapHttpEndPoint契约及其SnpCatalogService,但生成的引用正在查找SNP.SnpCatalogService