wcfDualHTTPBinding配置的服务器与客户端部署于不同机器的问题
2016-04-22 14:50
483 查看
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceBehavior">
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<wsDualHttpBinding>
<binding name="dualHttpBinding" transactionFlow="true" maxReceivedMessageSize="100000"
messageEncoding="Text" >
<security mode="None">
<message clientCredentialType="None" negotiateServiceCredential="false" />
</security>
</binding>
</wsDualHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="MyServiceBehavior" name="service.MyPublisher" >
<endpoint address="" binding="wsDualHttpBinding" contract="service.IMyContract" bindingConfiguration="dualHttpBinding">
<!--<identity>
<dns value="localhost"/>
</identity>-->
</endpoint>
<!--<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />-->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://192.168.0.139:8899/" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
</configuration>
以上是wsDualHTTPBinding的配置文件,wsDualHTTPBinding用于实现双向通信。红色部分加入之后,可以将服务器与客户端软件部署于不同的机器上(蓝色部分去除)。
如果没有下面这段红色部分:
<security mode="None"> <message clientCredentialType="None" negotiateServiceCredential="false" /> </security>客户端会出现如下异常报错:
The caller was not authenticated by the service.
部署于不同机器的另外一个需要注意的地方是:关闭防火墙。
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceBehavior">
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<wsDualHttpBinding>
<binding name="dualHttpBinding" transactionFlow="true" maxReceivedMessageSize="100000"
messageEncoding="Text" >
<security mode="None">
<message clientCredentialType="None" negotiateServiceCredential="false" />
</security>
</binding>
</wsDualHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="MyServiceBehavior" name="service.MyPublisher" >
<endpoint address="" binding="wsDualHttpBinding" contract="service.IMyContract" bindingConfiguration="dualHttpBinding">
<!--<identity>
<dns value="localhost"/>
</identity>-->
</endpoint>
<!--<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />-->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://192.168.0.139:8899/" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
</configuration>
以上是wsDualHTTPBinding的配置文件,wsDualHTTPBinding用于实现双向通信。红色部分加入之后,可以将服务器与客户端软件部署于不同的机器上(蓝色部分去除)。
如果没有下面这段红色部分:
<security mode="None"> <message clientCredentialType="None" negotiateServiceCredential="false" /> </security>客户端会出现如下异常报错:
The caller was not authenticated by the service.
部署于不同机器的另外一个需要注意的地方是:关闭防火墙。
相关文章推荐
- 虚拟机的网络模式
- 【JAVA】网络概念总结
- 谈谈HTTP协议中的短轮询、长轮询、长连接和短连接
- 2016西电校赛网络赛 Problem I 万神的竞赛
- 20160421HTTP Status 500 - java.lang.LinkageError loader constraint violation when resolving method o
- Android之从TCP/IP、HTTP看Socket通信
- 安卓网络请求框架对比
- java中的逆变、协变、不变概念讲解转载自http://www.cnblogs.com/en-heng/p/5041124.html,感谢编程路上的前辈们!
- 通过网络远程控制ARM系统GPIO应用实例
- 2016西电校赛网络赛 Problem J 万神的数列
- Win2003和Win2008防火墙导致FTP服务器不能访问的解决方法(转载自http://www.jb51.net/article/57008.htm)
- 获取网络域名的IP地址
- ios通过URL获取网络图片的原始大小
- Servlet——使用http响应头Content-Disposition下载文件的示例
- 2016西电校赛网络赛 Problem H 数学题
- http
- C# 抓取网页Html源码 (网络爬虫)
- 2016西电校赛网络赛 Problem G 合并模板
- AnyEvent::HTTP 介绍
- AnyEvent::HTTP 介绍