日期:2014-05-17  浏览次数:20409 次

WCF服务报错
<system.serviceModel>
    <services>
</services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="Basicbindings">
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceThrottling maxConcurrentCalls="20" maxConcurrentSessions="20" maxConcurrentInstances="30" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<bindings>
<basicHttpBinding>
<binding name="Basicbindings" maxReceivedMessageSize="202400000">
<readerQuotas maxStringContentLength="2024000000"/>
</binding>
</basicHttpBinding>
</bindings>

  </system.serviceModel>

这是我WCF服务端的配置,
下面是我调用WCF的客户端的配置:
<client>
            <endpoint address="http://localhost:1678/Interface/UserInterface.svc" behaviorConfiguration="NewBehavior"
              binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IUserInterface"
              contract="UserInterface.IUserInterface" name="BasicHttpBinding_IUserInterface" />

在调用服务时报错:

------解决方案--------------------
你在VS中直接浏览svc能访问不一定 客户端就能调用
你先保证端口是通,再确保元数据能正确下载,如果不能下载元数据,客户端是生成不了代理类的,

你服务发布后 http://localhost:1678/Interface/UserInterface.svc改过没

把你client端config里的

bindingConfiguration="BasicHttpBinding_IUserInterface"这个发来瞧瞧看你的Binding是怎么配的,
通常我们做wcf开发的时候,会用svcutil.exe这工具来为我们生成代理类和config!
------解决方案--------------------
你的服务端貌似没有设置端口号啊

看看下面这个配置
<span style="font-family:Times New Roman;font-size:18px;"><?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
  &nbs