采用IIS宿主的WCF,配置如下:
      <service behaviorConfiguration="MexBehavior" name="SOD.Service.JsonService">
        <endpoint address="" behaviorConfiguration="WebHttpBindingBehavior" bindingConfiguration="webLargeSize" binding="webHttpBinding" contract="SOD.Service.IJsonService"/>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>在方法前加了这句
[WebInvoke(UriTemplate = "FunctionName", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped)]如何才能使该方法在Winform客户端被访问到?报错如下:
没有终结点在侦听可以接受消息的http://localhost/Server/Json.svc.这通常是由于不正确的地址或者SOAP操作导致的。如果存在此情况,请参见InnerException以了解详细信息。
        WCF 

解决方案 »

  1.   

    http://localhost/Server/Json.svc服务你启动了吗...
    你要确保你的服务地址在你的电脑浏览器能打开...
      

  2.   


    当然...我在客户端调用如下:
        public class JsonService : System.ServiceModel.ClientBase<IJsonService>, IJsonService
        {
            public JsonService(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
                base(binding, remoteAddress)
            {
            }
        }不过貌似因为有【WebInvoke】,所以出问题了~