2011-04-29 59 views
1

我正在创建WCF服务。这是我的第一个。我收到错误:未找到WCF默认端点

Could not find default endpoint element that references contract 'WCFClient.IWCFClient' in the ServiceModel client configuration section.

我尝试过切换端点名称等,并删除/重新创建服务引用。我似乎无法弄清楚问题所在。

应用配置:

<bindings> 
    <basicHttpBinding> 
     <binding name="BasicHttpBinding_IWCFClient" 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:4295/Services/WCFClient.svc" 
      binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IWCFClient" 
      contract="WCFClient.IWCFClient" name="BasicHttpBinding_IWCFClient" /> 
    </client> 

服务配置:

<services> 
    <service behaviorConfiguration="WCFGraphicManagementTool.Services.WCFClientBehavior" 
    name="WCFGraphicManagementTool.Services.WCFClient"> 
     <endpoint address="" name="BasicHttpBinding_IWCFClient" binding="basicHttpBinding" contract="WCFGraphicManagementTool.Contracts.IWCFClient"> 
    </endpoint> 
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
    </service> 
</services> 
<behaviors> 
    <serviceBehaviors> 
    <behavior name="WCFGraphicManagementTool.Services.WCFClientBehavior"> 
     <dataContractSerializer maxItemsInObjectGraph="2147483647" /> 
     <serviceThrottling maxConcurrentCalls="120" maxConcurrentSessions="120" maxConcurrentInstances="120" /> 
     <serviceMetadata httpGetEnabled="True" /> 
     <serviceDebug includeExceptionDetailInFaults="True" /> 
    </behavior> 
    </serviceBehaviors> 
</behaviors>  
+0

你如何创建客户端代理? – 2011-04-29 13:26:22

+0

这是你的意思: – 2011-04-29 13:38:34

+0

WCFClient.WCFClientClient WCFClient = new WCFClient.WCFClientClient();这是它出错的路线。 – 2011-04-29 13:38:51

回答

1

我想通了。我需要将它添加到项目的web.config中。它在服务中,但不在项目中。

0

这通常是由于在配置文件并且或者合同名上指定的服务名称/命名空间之间的不匹配服务文件的源代码或标记。通常在通过Visual Studio创建新服务之后发生,然后重命名服务/名称空间。

在Solution Explorer中的.svc文件上单击右键,选择“查看标记”

检查的“服务”属性值是正确的。检查名称空间和名称是否与您分配的名称空间和名称相匹配。

应该是这样的:

<%@ ServiceHost Language="C#" Debug="true" Service="WCFGraphicManagementTool.Services.WCFClient" CodeBehind="WCFClient.svc.cs" %> 
相关问题