简体   繁体   English

ASP.NET 5 MVC 6中的web.config

[英]web.config in ASP.NET 5 MVC 6

I have a WCF .dll that loads configuration from web.config file. 我有一个WCF .dll从web.config文件加载配置。
I'm using that dll in asp.net 5 application, when I try to call a function from dll, I'm getting exception: 我在asp.net 5应用程序中使用该DLL,当我尝试从dll调用函数时,我得到异常:

Could not find default endpoint element that references contract 'WebService.MyWebService' in the ServiceModel client configuration section. 无法在ServiceModel客户端配置部分中找到引用合同“WebService.MyWebService”的默认端点元素。 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. dll的配置存在于web.config中。
This used to work in asp.net beta 6, but now that I upgraded to rc1 it doesn't work. 这曾经在asp.net beta 6中工作,但现在我升级到rc1它不起作用。

How can I make this work? 我怎样才能做到这一点?

As stated here : 如前所述这里

Support for app.config when running on the full .NET Framework 在完整的.NET Framework上运行时支持app.config
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. 在完整的.NET Framework上运行时,您现在可以使用System.Configuration从基于DNX的控制台应用程序访问app.config中的配置数据。 Simply put your XML configuration file next to your project.json file. 只需将您的XML配置文件放在project.json文件旁边即可。

So I only had to copy contents of web.config to app.config 所以我只需要将web.config的内容复制到app.config

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM