标签: .net-core-rc2

EF7 .NET Core 1 RC2添加迁移失败

我最近安装了.NET Core 1.0 RC2,我知道命令DNX已经改为dotnet.exe命令,但是我知道无法找到如何创建新的EF7 Migration文件.无论我尝试"dotnet ef"命令,我都会得到

dotnet : No executable found matching command "dotnet-ef"
At line:1 char:1
+ dotnet ef
+ ~~~~~~~~~
    + CategoryInfo          : NotSpecified: (No executable f...and "dotnet-ef":String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
Run Code Online (Sandbox Code Playgroud)

类似的东西,如果尝试VS PS控制台内的"添加迁移"命令,那就给我这个:

Add-Migration : The term 'Add-Migration' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the 
name, or if a path was included, verify that the path is correct and try again.
At …
Run Code Online (Sandbox Code Playgroud)

c# entity-framework ef-migrations visual-studio-2015 .net-core-rc2

5
推荐指数
1
解决办法
3471
查看次数

添加 id_token 作为声明 AspNetCore OpenIdConnect 中间件

我正在尝试IdTokenHint在发送注销请求时进行设置。在之前的Microsoft.Owin.Security.OpenIdConnect中间件中,我可以通过执行以下操作使用通知将 设置id_tokenSecurityTokenValidated方法中的声明SecurityTokenValidated

app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{
    ...
    Notifications = new OpenIdConnectAuthenticationNotifications
    {
        //Perform claims transformation
        SecurityTokenValidated = async notification =>
        {
            ...
            notification.AuthenticationTicket.Identity.AddClaim(new Claim("id_token", notification.ProtocolMessage.IdToken));
        },
        RedirectToIdentityProvider = async n =>
        {
            if (n.ProtocolMessage.RequestType == OpenIdConnectRequestType.LogoutRequest)
            {
                var idTokenHint = n.OwinContext.Authentication.User.FindFirst("id_token").Value;
                n.ProtocolMessage.IdTokenHint = idTokenHint;
             }
         }
    }
}
Run Code Online (Sandbox Code Playgroud)

使用新的中间件Microsoft.AspNetCore.Authentication.OpenIdConnect(在 ASP.NET Core RC2 中),我在尝试完成相同的事情时遇到了麻烦。我假设我应该Events像这样。

app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions
{
    ...
    Events = new OpenIdConnectEvents()
    {
         OnTokenValidated = context =>
         { …
Run Code Online (Sandbox Code Playgroud)

claims-based-identity openid-connect identityserver3 .net-core-rc2

5
推荐指数
1
解决办法
2164
查看次数

在没有Visual Studio 2015的情况下配置.NET Core Web应用程序启动设置

我遵循.NET Core RC2文档,大部分信息都是考虑Visual Studio 2015编写的.但是,他们还发布了Visual Studio Code,我也可以从命令行运行应用程序.

当我开发一个我没有VS2015的应用程序时,我无法做到

  1. 连接launchSettings.json到我的应用程序
  2. 更改启动设置例如Hosting Environment,launchUrl或默认port 5000,等等.

如果我在没有Visual Studio的情况下开发,如何设置这些属性?

.net-core visual-studio-code asp.net-core .net-core-rc2

5
推荐指数
1
解决办法
4962
查看次数

如何在.Net Core中将App.config更改为json配置文件

我的项目使用App.config来读取配置属性.示例: ConfigurationManager.AppSettings["MaxThreads"] 您是否知道我可以使用从json读取配置的库.谢谢.

asp.net-core-mvc .net-core asp.net-core asp.net-core-1.0 .net-core-rc2

5
推荐指数
1
解决办法
6637
查看次数

如何获取有关运行时.Net Core的信息

我有一个适用于Linux和Windows的应用程序.我需要知道应用程序在哪里使用差异代码.谢谢

asp.net-core-mvc .net-core asp.net-core asp.net-core-1.0 .net-core-rc2

5
推荐指数
1
解决办法
890
查看次数

适用于 Windows .netcore 应用程序的 Logstash

我是 Logstash 的新手。我觉得很有趣。但目前我正在处理与 .NET core 应用程序相关的日志记录。我使用 Logstash 来满足我的日志记录需求是否正确?看到logstash 仅用于服务器端日志记录后,我很困惑。

先谢谢您的帮助。

c# logging error-logging logstash .net-core-rc2

5
推荐指数
1
解决办法
1494
查看次数

二进制格式在netstandard 1.5

根据.NET CoreFx API列表及其相关的.NET Platform Standard版本,System.Runtime.Serialization.Formatters从1.3开始被添加到.NET平台标准中,这很酷,但是当我尝试创建.Net时核心类库目标netstandard1.5在.Net Core RC2下,我无法使用它.

代码很简单,只是想要声明一个BinaryFormatter:

public class Problems {
    private System.Runtime.Serialization.Formatters.Binary.BinaryFormatter _formatter;
}
Run Code Online (Sandbox Code Playgroud)

错误是:

错误CS0234名称空间"System.Runtime"中不存在类型或命名空间名称"序列化"(您是否缺少程序集引用?)

这是project.json,我没有做任何修改:

{
  "version": "1.0.0-*",

  "dependencies": {
    "NETStandard.Library": "1.5.0-rc2-24027",
  },

  "frameworks": {
    "netstandard1.5": {
      "imports": "dnxcore50"
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

那么,我需要依赖的另一个包吗?为什么?对于列表中的所有API,网络标准名称不应该足够吗?

c# binaryformatter .net-core-rc2

4
推荐指数
1
解决办法
4415
查看次数

3
推荐指数
1
解决办法
688
查看次数

在ASP.NET 4.6 MVC应用程序中引用.NET Core类库

我认为我在这里缺少一些东西,我提前为愚蠢道歉.试图拥抱dotnet核心的新世界,并将项目作为一种尝试学习的方式.

我已经编写了一些身份验证中间件来使用ASP.NET Core Identity.我使用.NET核类库作为中间件 - 优点是我相信我可以针对任何框架以及构建我的组件的Nuget包.当与基于VS2015 RC2模板的.NET Core的ASP.NET Core Web应用程序一起使用时,中间件可以正常工作.

我喜欢冒险,我决定创建一个基于OWIN/Katana认证中间件的组件版本,这样我就可以在ASP.NET 4.5/6 Web应用程序中使用它.我没有创建传统的类库项目,而是再次使用.NET Core Class Library模板,但仅针对.NET 4.6,即net46.它编译得很好,但我无法让我的ASP.NET 4.6应用程序引用它.我按照这个SO问题中的信息来创建一个NuGet包,创建一个本地源,然后尝试将它添加到我的ASP.NET 4.6项目,但它失败并出现错误:

无法解析依赖关系'NETStandard.Library'.使用的来源:'nuget.org','AspNetRc2Source','MyGet','本地','Microsoft和.NET','Microsoft Visual Studio离线包'.0

我的头脑旋转着依赖和框架.

无论如何,这里是我的.NET Core类库中的project.json文件 - 你可以看到它只针对.NET 4.6,这也是我的ASP.NET应用程序的目标.

.NET核心库 - 中间件组件

我觉得我需要一些严肃的.NET 101课程来了解所有这些依赖关系如何组合在一起,但如果有人能够指出我正确的方向,我将不胜感激.

.net asp.net .net-core asp.net-core .net-core-rc2

3
推荐指数
1
解决办法
1477
查看次数

.net核心中StreamReader的更短解决方案

我有这个基本代码来读取StreamReaderVS Code中带有Dotnet Core 的文件.我可以在Visual Studio中使用.net进行类似的操作,new StreamReader("file.json")它看起来小巧紧凑.

我正在寻找dotnet核心中的另一个类,它可以用更少的代码实现类似的结果

 using System;
 using System.IO;

namespace ConsoleApplication
{
    public class Program
    {
        public static void Main(string[] args)
        {
            StreamReader myReader = new StreamReader(new FileStream("project.json", FileMode.Open, FileAccess.Read)); 
            string line = " "; 

            while(line != null)
            {
                line = myReader.ReadLine(); 
                if(line != null)
                {
                    Console.WriteLine(line); 
                }
            }

            myReader.Dispose();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

c# .net-core .net-core-rc2

3
推荐指数
1
解决办法
6627
查看次数