IOptions<应用>在ASP.NET 5 Beta 8中不包含定义“选项” [英] IOptions<Applications> does not contain definition 'Options' in ASP.NET 5 Beta 8

查看:159
本文介绍了IOptions<应用>在ASP.NET 5 Beta 8中不包含定义“选项”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题



我将beta7应用升级到beta8时遇到问题。我原来已经有超过50个错误,但是我基本上得到了两个持续的错误,我一直无法解决。一个是选项。



选项缺少错误



这是错误:


错误CS1061'IOptions< ApplicationSettings>'不包含'Options'的定义,没有扩展方法'Options'接受'IOptions'类型的第一个参数, ApplicationSettings>'可以找到(你是否缺少一个using指令或程序集引用?)SampleProject.DNX 4.5.1


这里是代码:

  private IOptions< ApplicationSettings> _applicationSettings; 

//验证Active Directory的用户凭据
bool isAuthenticated = await Authentication.ValidateCredentialsAsync(
domainController:_applicationSettings.Options.DomainController,
port:_applicationSettings.Options。 DomainControllerSslPort,
域:_applicationSettings.Options.DomainController,
用户名:model.eID,
密码:model.Password);

上面的具体问题是使用 _applicationSettings.Options.DomainController



尝试:



我尝试过以下操作: p>


  • 我尝试使用智能感知和GitHub来查找IOptions的选项的位置,但我一直没有成功。

  • 我还尝试了 dnu restore 只是为了确保升级没有对我的project.json锁做一些奇怪的事情。



现在beta8功能完整,我可能会重写我项目的重要部分。但是,现在我需要解决这些错误,以便我可以再次编译该项目。任何帮助,协助和建议将不胜感激。



注意:我根据反馈编辑了一个问题

解决方案

选项属性 IOptions< T> 已重命名为。尝试:

  _applicationSettings.Value 

另请参阅此问题


Problem

I am having trouble with upgrading my beta7 application to 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. 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

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

Attempts:

I tried the following things:

  • I tried using intellisense and GitHub to find where 'Options' for IOptions went, but I have been unsuccessful.
  • I also tried dnu restore just to be sure the upgrade didn't do something strange with my project.json lock.

Now that beta8 is feature complete, I may rewrite significant portions of my project. 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. Try:

_applicationSettings.Value

Also see this issue.

这篇关于IOptions&LT;应用&GT;在ASP.NET 5 Beta 8中不包含定义“选项”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆