【发布时间】:2016-01-08 18:05:56
【问题描述】:
在我的项目中,我有一个包含 WCF 服务连接的类库。
在旧的 ASP.NET MVC 中,为了使用服务方法,我只需要在我的 web.config 中添加绑定,它就会正常工作。
我现在遇到的问题是,当我在 ASP.NET5 中调用 Web 服务时,我得到了这个异常:
InvalidOperationException: Could not find default endpoint element that references contract 'xxx' in the ServiceModel client configuration section.
This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.
有没有一种方法可以像在旧 MVC 应用程序中那样添加我的绑定?
【问题讨论】:
-
您实际上不必将绑定添加到配置文件。相反,以编程方式创建它们。
-
我在解决方案的几个 MVC 项目中使用这个库,并希望使用相同的方法。有可能吗?
标签: c# wcf asp.net-core