关于WCF的问题

iceMung 2013-06-05 11:02:51
采用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以了解详细信息。




...全文
62 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
iceMung 2013-06-05
  • 打赏
  • 举报
回复
引用 1 楼 yysyangyangyangshan 的回复:
http://localhost/Server/Json.svc服务你启动了吗... 你要确保你的服务地址在你的电脑浏览器能打开...
当然... 我在客户端调用如下:
    public class JsonService : System.ServiceModel.ClientBase<IJsonService>, IJsonService
    {
        public JsonService(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
            base(binding, remoteAddress)
        {
        }
    }
不过貌似因为有【WebInvoke】,所以出问题了~
杨友山 2013-06-05
  • 打赏
  • 举报
回复
http://localhost/Server/Json.svc服务你启动了吗... 你要确保你的服务地址在你的电脑浏览器能打开...

110,567

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧