WCF WindowServer服务 配置问题
WCF简单程序代码:
本地机器既做服务器也做客户端,服务宿主用WindowsServer 客户端WindowForm.
服务端appconfig配置文件入下:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<add name="ValidDB" providerName="System.Data.SqlClient"
connectionString="Data Source=.;Initial Catalog=ValidDB;Integrated Security=True"/>
</connectionStrings>
<system.serviceModel>
<services>
<service name="ValidataInputDataERP.Service.DeptService" behaviorConfiguration="SampleBehavior">
<endpoint address="" binding="wsHttpBinding" contract="ValidataInputDataERP.Contract.IDept" />
<endpoint binding="mexHttpBinding" contract="IMetadataExchange" address="mex" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:1123/HostByWS/"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="SampleBehavior">
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="True" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
--------
客户端appconfig是通过添加引用服务自动生成的代码如下:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IDept" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:1123/HostByWS/" binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IDept" contract="Dept.IDept"
name="WSHttpBinding_IDept">
<identity>
<servicePrincipalName value="host/tankerz" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
-----------
本地测试 都可以调用成功。
然后我打算把服务放到192.168.22.232服务器上,于是把上述的localhost:1123 全部改为
192.168.22.232:1123 ,然后把WindowServer服务在192.168.22.232:1123安装上,本地作为客户端 开始测试始终不成功,如何配置到服务器端呢 这个问题一直不会。请教下各位
请教原因。
本人QQ 1391191840 长期在线
[解决办法]
WCF 配置
[解决办法]
我觉得是防火墙的问题。。。
[解决办法]
服务端机器防火墙的详细设定tab项中设定中勾选web service(http)
[解决办法]
对看看是不是防火墙block了1123 端口。
[解决办法]
WCF 与 IIS 剖析