在 ServiceModel 客户端配置部分中,找不到引用协定“ServiceReference1.IPathIdentifyService”的默认终结点元素
2015-10-23 15:58
453 查看
参考文章:http://bbs.csdn.net/topics/300169856 在第11楼
----------------------------------------------------------------------------------------------
我的环境:VS2010 + C#(DLL) + WCF
即我使用C#编写了一个DLL,在DLL里面远程调用WCF服务,然后EXE程序在调用DLL里面的接口时,出现了如下错误:
System.InvalidOperationException: 在 ServiceModel 客户端配置部分中,找不到引用协定“ServiceReference1.IPathIdentifyService”的默认终结点元素。这可能是因为未找到应用程序的配置文件,或者是因为客户端元素中找不到与此协定匹配的终结点元素。
在 System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName)
在 System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName, Configuration configuration)
在 System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName)
在 System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address)
在 System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)
在 System.ServiceModel.EndpointTrait`1.CreateSimplexFactory()
在 System.ServiceModel.EndpointTrait`1.CreateChannelFactory()
在 System.ServiceModel.ClientBase`1.CreateChannelFactoryRef(EndpointTrait`1 endpointTrait)
在 System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef()
在 System.ServiceModel.ClientBase`1..ctor()
...
-------------------------------------------------------------------------------------------------------
解决方法:
调用WCF的类库(即xxx.dll)会有一个app.config文件,把这个文件中的以下部分
<system.serviceModel>
省略
</system.serviceModel>
复制粘贴到主程序(EXE所在工程)的app.config文件中的<configuration></configuration>中。
-------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------
我的环境:VS2010 + C#(DLL) + WCF
即我使用C#编写了一个DLL,在DLL里面远程调用WCF服务,然后EXE程序在调用DLL里面的接口时,出现了如下错误:
System.InvalidOperationException: 在 ServiceModel 客户端配置部分中,找不到引用协定“ServiceReference1.IPathIdentifyService”的默认终结点元素。这可能是因为未找到应用程序的配置文件,或者是因为客户端元素中找不到与此协定匹配的终结点元素。
在 System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName)
在 System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName, Configuration configuration)
在 System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName)
在 System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address)
在 System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)
在 System.ServiceModel.EndpointTrait`1.CreateSimplexFactory()
在 System.ServiceModel.EndpointTrait`1.CreateChannelFactory()
在 System.ServiceModel.ClientBase`1.CreateChannelFactoryRef(EndpointTrait`1 endpointTrait)
在 System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef()
在 System.ServiceModel.ClientBase`1..ctor()
...
-------------------------------------------------------------------------------------------------------
解决方法:
调用WCF的类库(即xxx.dll)会有一个app.config文件,把这个文件中的以下部分
<system.serviceModel>
省略
</system.serviceModel>
复制粘贴到主程序(EXE所在工程)的app.config文件中的<configuration></configuration>中。
-------------------------------------------------------------------------------------------------------------------------------
相关文章推荐
- c#调用COM组件
- C#实现把指定数据写入串口
- C#动态创建button的方法
- C#中抽象方法与虚拟方法的区别
- c#中虚函数的相关使用方法
- C#使用加边法计算行列式的值
- C#实现多线程的同步方法实例分析
- C#中尾递归的使用、优化及编译器优化
- C#实现子窗体与父窗体通信方法实例总结
- C#通用邮件发送类分享
- C#中this的用法集锦
- C#.NET获取拨号连接的宽带连接方法
- C#异步绑定数据实现方法
- C#实现AddRange为数组添加多个元素的方法
- C#中Equality和Identity浅析
- 解析Silverlight调用WCF/Rest异常的解决方法
- C#生成饼形图及添加文字说明实例代码
- C#判等对象是否相等的方法汇总
- C#简单的向量用法实例教程
- C#实现基于链表的内存记事本实例