【发布时间】:2018-07-31 15:21:21
【问题描述】:
我在 IIS 上托管了这个 WCF 服务。当我尝试使用以下代码在我的客户端项目中使用它时,出现以下异常“发送请求时发生错误”
LaunchService.LaunchServiceClient launchServiceClient =
new LaunchService.LaunchServiceClient(
new BasicHttpBinding(),
new EndpointAddress("http:// Service base address"));
如果我在上面的代码中将BasicHttpBinding() 更改为WebHttpBinding()(如在我的 web.config 文件中),我会收到此错误
"System.TypeLoadException: '无法加载类型 程序集中的“System.ServiceModel.WebHttpBinding” 'System.ServiceModel.Web,版本=4.0.0.0,文化=中性, PublicKeyToken=31bf3856ad364e35'.'"
使用默认构造函数时,我得到这个错误
"System.PlatformNotSupportedException: '配置文件不是 支持的。 "
LaunchService.LaunchServiceClient 启动服务 = 新 LaunchService.LaunchServiceClient();
我尝试更改 web 配置文件中的设置,但其中的任何更改都不会使服务正常工作。
有什么帮助吗?
提前谢谢..
【问题讨论】:
-
我收到“System.PlatformNotSupportedException:'配置文件不受支持。”这是由于通过 nuget 在我的 .net 框架项目中意外包含了一个 .net 核心库。我必须编辑他的项目文件才能删除它。
标签: c# wcf binding hosting wcfserviceclient