简体   繁体   English

选项 <Applications> 在ASP.NET 5 Beta 8中不包含定义“选项”

[英]IOptions<Applications> does not contain definition 'Options' in ASP.NET 5 Beta 8

Problem 问题

I am having trouble with upgrading my beta7 application to beta8. 我在将beta7应用程序升级到beta8时遇到麻烦。 I orginally had over 50 errors, but I have basically gotten it down to two persistent errors remaining that I have been unable to resolve. 我本来有50多个错误,但基本上可以归结为两个持久性错误,这些错误我一直无法解决。 One is with Options. 一种是带有选项。

Options Missing Error 选项丢失错误

Here is the error: 这是错误:

Error CS1061 'IOptions<ApplicationSettings>' does not contain a definition for 'Options' and no extension method 'Options' accepting a first argument of type 'IOptions<ApplicationSettings>' could be found (are you missing a using directive or an assembly reference?) SampleProject.DNX 4.5.1 错误CS1061'IOptions <ApplicationSettings>'不包含'Options'的定义,并且找不到扩展方法'Options'接受类型为'IOptions <ApplicationSettings>'的第一个参数(是否缺少using指令或程序集引用?)SampleProject.DNX 4.5.1

Here is the code: 这是代码:

private IOptions<ApplicationSettings> _applicationSettings;

// Authenticate user credentials against Active Directory
bool isAuthenticated = await Authentication.ValidateCredentialsAsync(
                domainController: _applicationSettings.Options.DomainController,
                port: _applicationSettings.Options.DomainControllerSslPort,
                domain: _applicationSettings.Options.DomainController,
                username: model.eID,
                password: model.Password);

The specific problem above is with _applicationSettings.Options.DomainController 上面的特定问题是_applicationSettings.Options.DomainController

Attempts: 尝试次数:

I tried the following things: 我尝试了以下操作:

  • I tried using intellisense and GitHub to find where 'Options' for IOptions went, but I have been unsuccessful. 我尝试使用intellisense和GitHub查找IOptions的“ Options”去向,但未成功。
  • I also tried dnu restore just to be sure the upgrade didn't do something strange with my project.json lock. 我还尝试了dnu restore ,以确保升级不会对我的project.json锁造成任何奇怪的影响。

Now that beta8 is feature complete, I may rewrite significant portions of my project. 现在beta8已完成功能,我可以重写项目的重要部分。 However, for now I need to resolve these errors so that I can compile the project again. 但是,现在我需要解决这些错误,以便我可以再次编译该项目。 Any help, assistance, and advice rendered would be greatly appreciated. 任何帮助,协助和建议,将不胜感激。

Note : I edited this to one question based on feedback 注意 :我根据反馈将其编辑为一个问题

The Options property of IOptions<T> was renamed to Value . IOptions<T>Options属性已重命名为Value Try: 尝试:

_applicationSettings.Value

Also see this issue . 另请参阅此问题

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

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