急wcf没终结点对可能接受消息的 进行监听
急急急····wcf没有终结点对可能接受消息的 进行监听
我winform中写了一个wcf服务 代理类是用NetCFSvcUtil.exe生成的 然后再另一个类中替换连接地址
webconfig 中配置
在客户端调用是这样写的
在服务端webconfig中配置
我winform中写了一个wcf服务 代理类是用NetCFSvcUtil.exe生成的 然后再另一个类中替换连接地址
public static RFLoginClient connectLoginService(string serviceAdress)
{
RFLoginClient _serviceClient;
//if (_serviceClient == null)
//{
BasicHttpBinding httpBinding = new BasicHttpBinding();
httpBinding.MaxReceivedMessageSize = 2147483647;
httpBinding.SendTimeout = new TimeSpan(0, 10, 0);
//System.ServiceModel.Channels.Binding binding = SfTaskPknClient.CreateDefaultBinding();
string remoteAddress = RFLoginClient.EndpointAddress.Uri.ToString();
remoteAddress = remoteAddress.Replace("localhost", serviceAdress);
EndpointAddress endpoint = new EndpointAddress(remoteAddress);
_serviceClient = new RFLoginClient(httpBinding, endpoint);
// }
return _serviceClient;
}
webconfig 中配置
<add key="WebServiceUrl" value="开发服务器" />
<add key="_开发服务器" value="localhost:18088/RFServiceHost"/>
在客户端调用是这样写的
_loginParams = new LoginParams();
_loginParams.ServiceAdress = _settings.GetString("_" + cmbServer.Text);
//LoginParams._ServiceAdress = _loginParams.ServiceAdress;
_serviceClient = ServiceUtil.connectLoginService(_loginParams.ServiceAdress);
//_serviceClient 中的地址在调试中看到 地址跟浏览器地址是一样的
// 登录验证
LoginInfo loginInfo = _serviceClient.Login(this.cmbUserCode.Text, this.txtPSW.Text, this.cmbWarehouse.Text);
在服务端webconfig中配置
<system.serviceModel>
<protocolMapping>
<add scheme="http" binding="basicHttpBinding" bindingConfiguration="MyBasicHttpBinding" />
</protocolMapping>
<bindings>
<basicHttpBinding>