web.config in ASP.NET 5 MVC 6

白昼怎懂夜的黑 提交于 2019-12-13 15:08:30

问题


I have a WCF .dll that loads configuration from web.config file.
I'm using that dll in asp.net 5 application, when I try to call a function from dll, I'm getting exception:

Could not find default endpoint element that references contract 'WebService.MyWebService' 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.

The configuration for dll exists in web.config.
This used to work in asp.net beta 6, but now that I upgraded to rc1 it doesn't work.

How can I make this work?


回答1:


As stated here:

Support for app.config when running on the full .NET Framework
When running on the full .NET Framework you can now use System.Configuration to access configuration data in app.config from a DNX based console application. Simply put your XML configuration file next to your project.json file.

So I only had to copy contents of web.config to app.config



来源:https://stackoverflow.com/questions/34022320/web-config-in-asp-net-5-mvc-6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!