采用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
<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
解决方案 »
- C# socket连接建立时,如何判断对方已经与其他socket建立连接
- 在aspx页面调用AspNetPager用户控件总是说编译错误或缺少webconfig配置文件
- 一个简单问题,把SQL查询出的最早时间和最晚时间填入textbox
- c#中socket编程模型有哪些?
- 为什么网站启动一段时间后会出现用登录后打开新的页面还要重新登录
- 程序代码发生异常,可否利用Attribute属性进行捕获,并且对异常信息进行处理
- 怎么做C#的任务栏菜单
- c#中“字段”是什么意思??
- C#里有没有椭圆形的控件?如果没有的话有什么办法可以实现??
- web api 如何调用另一个进程,保证先返回值,进程不退出
- [求助]C# winform 实现滚屏显示 类似股市行情
- "对COM 组件的调用返回了错误HRESULT E_FAIL",在枚举OPC服务器时候出现这个错误提示
你要确保你的服务地址在你的电脑浏览器能打开...
当然...我在客户端调用如下:
public class JsonService : System.ServiceModel.ClientBase<IJsonService>, IJsonService
{
public JsonService(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress)
{
}
}不过貌似因为有【WebInvoke】,所以出问题了~