首页 新闻 搜索 专区 学院

WCF客户端无法读取配置文件 ChannelFactory<ILoginService>

0
悬赏园豆:10 [已关闭问题]

WCF配置程序如下:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <client>
      <endpoint address="http://localhost:8888/DotNet.Service/BusinessCardService/" binding="basicHttpBinding" bindingConfiguration="HTTP" contract="DotNet.IService.IBusinessCardService"  name="DotNet.Service.BusinessCardService"></endpoint>
      <endpoint address="http://localhost:8888/DotNet.Service/ExceptionService/" binding="basicHttpBinding" bindingConfiguration="HTTP" contract="DotNet.IService.IExceptionService" name="DotNet.Service.ExceptionService"></endpoint>
      <endpoint address="http://localhost:8888/DotNet.Service/FileService/" binding="basicHttpBinding" bindingConfiguration="HTTP" contract="DotNet.IService.IFileService" name="DotNet.Service.FileService"></endpoint>
      <endpoint address="http://localhost:8888/DotNet.Service/FolderService/" binding="basicHttpBinding" bindingConfiguration="HTTP" contract="DotNet.IService.IFolderService" name="DotNet.Service.FolderService"></endpoint>
      <endpoint address="http://localhost:8888/DotNet.Service/ItemDetailsService/" binding="basicHttpBinding" bindingConfiguration="HTTP" contract="DotNet.IService.IItemDetailsService" name="DotNet.Service.ItemDetailsService"></endpoint>
      <endpoint address="http://localhost:8888/DotNet.Service/ItemsService/" binding="basicHttpBinding" bindingConfiguration="HTTP" contract="DotNet.IService.IItemsService" name="DotNet.Service.ItemsService"></endpoint>
      <endpoint address="http://localhost:8888/DotNet.Service/LoginService/" binding="basicHttpBinding" bindingConfiguration="HTTP" contract="DotNet.IService.ILoginService" name="DotNet.Service.LoginService"></endpoint>
      <endpoint address="http://localhost:8888/DotNet.Service/LogService/" binding="basicHttpBinding" bindingConfiguration="HTTP" contract="DotNet.IService.ILogService" name="DotNet.Service.LogService"></endpoint>
      <endpoint address="http://localhost:8888/DotNet.Service/MessageService/" binding="basicHttpBinding" bindingConfiguration="HTTP" contract="DotNet.IService.IMessageService" name="DotNet.Service.MessageService"></endpoint>
      <endpoint address="http://localhost:8888/DotNet.Service/ModuleService/" binding="basicHttpBinding" bindingConfiguration="HTTP" contract="DotNet.IService.IModuleService" name="DotNet.Service.ModuleService"></endpoint>
      <endpoint address="http://localhost:8888/DotNet.Service/OrganizeService/" binding="basicHttpBinding" bindingConfiguration="HTTP" contract="DotNet.IService.IOrganizeService" name="DotNet.Service.OrganizeService"></endpoint>
      <endpoint address="http://localhost:8888/DotNet.Service/ParameterService/" binding="basicHttpBinding" bindingConfiguration="HTTP" contract="DotNet.IService.IParameterService" name="DotNet.Service.ParameterService"></endpoint>
      <endpoint address="http://localhost:8888/DotNet.Service/PermissionAdminService/" binding="basicHttpBinding" bindingConfiguration="HTTP" contract="DotNet.IService.IPermissionAdminService" name="DotNet.Service.PermissionAdminService"></endpoint>
      <endpoint address="http://localhost:8888/DotNet.Service/PermissionService/" binding="basicHttpBinding" bindingConfiguration="HTTP" contract="DotNet.IService.IPermissionService" name="DotNet.Service.PermissionService"></endpoint>
      <endpoint address="http://localhost:8888/DotNet.Service/RoleService/" binding="basicHttpBinding" bindingConfiguration="HTTP" contract="DotNet.IService.IRoleService" name="DotNet.Service.RoleService"></endpoint>
      <endpoint address="http://localhost:8888/DotNet.Service/SequenceService/" binding="basicHttpBinding" bindingConfiguration="HTTP" contract="DotNet.IService.ISequenceService" name="DotNet.Service.SequenceService"></endpoint>
      <endpoint address="http://localhost:8888/DotNet.Service/StaffService/" binding="basicHttpBinding" bindingConfiguration="HTTP" contract="DotNet.IService.IStaffService" name="DotNet.Service.StaffService"></endpoint>
      <endpoint address="http://localhost:8888/DotNet.Service/UserService/" binding="basicHttpBinding" bindingConfiguration="HTTP" contract="DotNet.IService.IUserService" name="DotNet.Service.UserService"></endpoint>
      <endpoint address="http://localhost:8888/DotNet.Service/WorkReportService/" binding="basicHttpBinding" bindingConfiguration="HTTP" contract="DotNet.IService.IWorkReportService" name="DotNet.Service.WorkReportService"></endpoint>
    </client>
    <bindings>
      <basicHttpBinding>
        <binding name="HTTP" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
        </binding>
      </basicHttpBinding>
    </bindings>
  </system.serviceModel>
</configuration>

 

这个程序可以执行

            BasicHttpBinding binding = new BasicHttpBinding();
            binding.MaxBufferPoolSize = int.MaxValue;
            binding.MaxReceivedMessageSize = int.MaxValue;
            EndpointAddress address = new EndpointAddress("http://localhost:8888/DotNet.Service/LoginService/");
            ChannelFactory<ILoginService> factory = new ChannelFactory<ILoginService>(binding, address);
            ILoginService proxy = factory.CreateChannel();
            return proxy;

 

用下面的程序无法正确执行

            //ChannelFactory<ILoginService> channelFactory = new ChannelFactory<ILoginService>("DotNet.Service.LoginService");
            //ILoginService proxy = channelFactory.CreateChannel();
            //return proxy;

无法能读取到配置文件

通用C#系统架构的主页 通用C#系统架构 | 小虾三级 | 园豆:504
提问于:2010-06-08 19:40
< >
分享
其他回答(1)
0

坦白说,本不想回答,但想了下,既然我在博问是冲着回答问题来的,所以就需要一视同仁,故写一点说法....

这个是个最基本的WCF的配置问题,具体的我觉得你需要重新看下WCF相关的MSDN..

西越泽 | 园豆:10633 (专家六级) | 2010-06-09 13:03
0

DotNet.Service.LoginService

需要在config配置文件中增加相应服务的basicHttpBinding的配置

geekwang | 园豆:210 (菜鸟二级) | 2010-08-31 15:11
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册