我在.net-core Preview-2的Web api项目中尝试了jwt令牌身份验证,但是它无法正常工作。
JwtBearerAppBuilderExtensions.UseJwtBearerAuthentication(IA ?? pplicationBuilder,JwtBearerOptions)'已过时:'see go.microsoft.com/fwlink/?linkid=845470';
当我尝试使用相同的代码来标记Net Core 1.2时,它可以正常运行。我该怎么办?
我有List<SelectListItem>两个值的变量。我想将它表示为 html 中的下拉框,所以我这样做。
<div class="form-group row">
<label asp-for="Roles" class="col-sm-2 col-sm-offset-2 form-control-label"></label>
<div class="col-md-6">
<select asp-for="Roles" asp-items="@Model.Roles" class="form-control selectpicker bs-select-hidden"></select>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
这段代码向我展示了包含这两个项目的列表,但它也会生成
multiple="multiple"
Run Code Online (Sandbox Code Playgroud)
选择标签的属性。
我怎样才能不生成多个属性?
我使用 Visual Studio 2015 更新 2 社区版。
使用 Visual Studio DotNetCore RC1 工具,我在 DNX 部分下有我的自定义项目模板。我无法提供证明截图,因为我已经转移到 DotNetCore RC2 工具预览版 1。使用最后一组工具,我丢失了我的项目模板。
我尝试将 ProjectType 和 ProjectSubType 从 DNX 更改为 CSharp/Web,尝试将组件放在不同的地方,但没有成功。
最后一个 .vstemplate 文件有以下内容
<?xml version="1.0" encoding="utf-8"?>
<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Item">
<TemplateData>
<DefaultName>ReactComponent</DefaultName>
<Name>ReactComponent</Name>
<Description>ReactComponent</Description>
<TemplateID>Chandrush.ReactComponent</TemplateID>
<ProjectType>CSharp</ProjectType>
<ProjectSubType>Web</ProjectSubType>
<Icon>__TemplateIcon.ico</Icon>
</TemplateData>
<TemplateContent>
<References />
<ProjectItem TargetFileName="$fileinputname$\$fileinputname$.tsx" ReplaceParameters="true">ReactComponent.tsx</ProjectItem>
<ProjectItem TargetFileName="$fileinputname$\package.json" ReplaceParameters="true">package.json</ProjectItem>
<ProjectItem TargetFileName="$fileinputname$\$fileinputname$.scss" ReplaceParameters="true">ComponentStyle.scss</ProjectItem>
</TemplateContent>
</VSTemplate>
Run Code Online (Sandbox Code Playgroud)
有人知道使用 .NetCore RC2 preview1 工具将自定义项目模板恢复到 VS2015u2 的解决方案吗?
如何使用EF7 RC2抑制环境事务警告?
所述SuppressAmbientTransactionWarning()方法不能被发现.
我是.net核心的新手.我需要一些帮助来配置我的project.json文件来创建一个带.net核心的类库.我实际上阅读了很多文档,但是由于有大量的东西需要阅读,我很遗憾.我知道我必须使用NETStandardLibray(https://github.com/dotnet/corefx/blob/master/Documentation/architecture/net-platform-standard.md),但我不知道怎么把它放进去我的config.json文件.
这是我的config.json文件:
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0-rc2-3002702"
},
"xunit": "2.1.0",
"dotnet-test-xunit": "1.0.0-rc2-build10025"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dnxcore50",
"portable-net45+win8"
]
}
},
"testRunner": "xunit"
}
Run Code Online (Sandbox Code Playgroud)
我想构建一个简单的类库,以便在另一个项目中重用,我也希望它有单元测试.
我在这里的主要困难是关于绰号.他们真是一团糟.我只是想构建一个可以在任何平台上使用的类库,但看起来我必须在我的project.json中选择平台.在已弃用的标记列表中,我不知道我应该使用什么名字.为了使用NET标准库,我应该将具有nuget标识符netcoreapp1.0的平台.NET Standard Application 1.5作为目标,还是应该使用具有nuget标识符netstandard1.3的平台.NET Platform 5.0?什么是正确的平台?NETStandard Library不应该与平台无关吗?我应该将这些标识符放在我的project.json的依赖项或框架部分中吗?那两个部分的区别是什么?我完全迷失了:(
我正在接受这个命令
Dictionary<UInt64, int> myIntDict = new Dictionary<UInt64, int>(89478458);
Run Code Online (Sandbox Code Playgroud)
这个错误:
System.OutOfMemoryException was unhandled HResult=-2147024882
Message=Array dimensions exceeded supported range.
Source=mscorlib
StackTrace:
at System.Collections.Generic.Dictionary`2.Initialize(Int32 capacity)
at System.Collections.Generic.Dictionary`2..ctor(Int32 capacity, IEqualityComparer`1 comparer)
Run Code Online (Sandbox Code Playgroud)
在89478457上没有错误.以下是Dictionary.cs中Initialize的来源:
private void Initialize(int capacity)
{
int size = HashHelpers.GetPrime(capacity);
...
entries = new Entry[size];
...
}
Run Code Online (Sandbox Code Playgroud)
当我重现它时,错误发生在数组创建上.在这种情况下,条目是一个结构,大小为24.当我们得到max int32(0x80000000-1)并除以24 = 89478485时,这个数字在素数89478457和89478503之间.
这是否意味着,结构数组不能像maxInt32/sizeOfThisStruct那样大?
编辑:
是.我实际上超过2 GB.当字典创建struct Entry的内部数组时,会发生这种情况,其中存储了(键,值)对.在我的例子中,sizeof(Entry)是24个字节,并且值类型是内联分配的.
解决方案是使用gcAllowVeryLargeObjects 标志(谢谢Evk).实际上在.net核心中,标志是环境变量 COMPlus_gcAllowVeryLargeObjects(谢谢svick).
是的,狗仔队是对的.我要思考,怎么不浪费记忆.谢谢你们.
我想在 MVC-6 RC2 中使用自定义 jquery 不显眼的验证器
与旧答案类似,我在This one 中看到了一些 RC2 示例,但我不知道如何为文件实现它。
这是我的查看模式
public class FileUploadViewModel
{
//TODO [FileType(Validtype="jpeg,png,jif", MaxSize=112222)]// this is what I want
[Required(ErrorMessage = "Please select a file")]
public IFormFile File { get; set; }
[Required(ErrorMessage = "Please select link")]
public string FileName { get; set; }
public string ExternalLink { get; set; }
public string Description { get; set; }
}
Run Code Online (Sandbox Code Playgroud) asp.net-mvc unobtrusive-validation asp.net-core-mvc .net-core-rc2