小编Ruh*_*iot的帖子

登录后身份服务器 404(卡在 signin-oidc)

我按照 Identity Server 4 文档在我的本地机器上设置了一个示例服务器。我的问题是,在我登录后,应用程序卡在“signin-oidc”页面上,并且日志显示 404。我按照说明进行了 T,甚至删除了所有内容并重新开始。因此,根据http://docs.identityserver.io/en/latest/quickstarts/2_interactive_aspnetcore.html 上的文档,当前设置是一个准系统 IdSvr4 项目 (is4inmem) 和一个新的 ASPNetCore MVC 应用程序

我所做的唯一更改是将所有 URL 更改为 HTTPs 并使用 appsettings.json 文件而不是Config类。因为我没有改变任何实质性的东西,所以我无能为力。

我的 MVC 的日志看起来像这样

info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/2 GET https://localhost:44377/Home/Claims
info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[2]
      Authorization failed.
info: Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler[12]
      AuthenticationScheme: oidc was challenged.
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished in 559.8895ms 200 text/html;charset=UTF-8
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/2 POST https://localhost:44377/signin-oidc application/x-www-form-urlencoded 547
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished in 3.2205ms 404
Run Code Online (Sandbox Code Playgroud)

虽然主 IdSvr4 项目的日志看起来像这样

[00:26:01 Debug] IdentityServer4.Validation.AuthorizeRequestValidator
Start authorize request protocol …
Run Code Online (Sandbox Code Playgroud)

c# openid-connect asp.net-core identityserver4

15
推荐指数
1
解决办法
1万
查看次数

Caliburn.Micro嵌套了ViewModels的最佳实践

这是一个很长的问题,所以请耐心等待.

目前我正在开发一个小工具,旨在帮助我跟踪我的故事中无数的角色.

该工具执行以下操作:

  • 将当前存储为json的字符加载到磁盘上,并将它们存储在列表中,该列表通过ListBox在Shell中显示.
  • 如果用户随后打开一个字符,则Shell(即a Conductor<Screen>.Collection.OneActive)会打开一个新的CharacterViewModel,派生自Screen.
  • Character获取即将通过要打开的汉字IEventAggregator信息系统.
  • CharacterViewModel还具有其是结合至各个子查看子的ViewModels各种属性.

这是我的问题:目前我在初始化时手动初始化子ViewModels ChracterViewModel.但这对我来说听起来很可疑,我很确定有更好的方法可以做到这一点,但我看不出应该怎么做.

这是代码CharacterViewModel:

/// <summary>ViewModel for the character view.</summary>
public class CharacterViewModel : Screen, IHandle<DataMessage<ICharacterTagsService>>
{
    // --------------------------------------------------------------------------------------------------------------------
    // Fields
    // -------------------------------------------------------------------------------------------------------------------

    /// <summary>The event aggregator.</summary>
    private readonly IEventAggregator eventAggregator;

    /// <summary>The character tags service.</summary>
    private ICharacterTagsService characterTagsService;

    // --------------------------------------------------------------------------------------------------------------------
    // Constructors & Destructors
    // -------------------------------------------------------------------------------------------------------------------

    /// <summary>Initializes a new instance of the <see cref="CharacterViewModel"/> class.</summary>
    public CharacterViewModel() …
Run Code Online (Sandbox Code Playgroud)

c# wpf mvvm caliburn.micro

8
推荐指数
1
解决办法
2582
查看次数

实体框架在执行UPDATE语句时抛出异常

我有一个EF6驱动的程序,在第一次运行时崩溃UPDATE语句.我尝试通过数据注释重命名列(我没有测试流体API,因为它应该导致相同的数据库).我也查看了课程的可见性,但是自上次课程开始以来它们没有改变,因此可以排除.我已经看了一天中的大部分时间,但找不到错误.数据库看起来很健康,代码编译没有问题.此外,任何update-database语句都可以无异常地执行.

这是堆栈跟踪:

System.Data.DataException was unhandled by user code
  HResult=-2146233087
  Message=An exception occurred while initializing the database. See the InnerException for details.
  Source=EntityFramework
  StackTrace:
       bei System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action)
       bei System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization()
       bei System.Data.Entity.Internal.LazyInternalContext.<InitializeDatabase>b__4(InternalContext c)
       bei System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input)
       bei System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action)
       bei System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase()
       bei System.Data.Entity.Internal.InternalContext.Initialize()
       bei System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
       bei System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
       bei System.Data.Entity.Internal.Linq.InternalSet`1.Include(String path)
       bei System.Data.Entity.Infrastructure.DbQuery`1.Include(String path)
       bei System.Data.Entity.QueryableExtensions.Include[T](IQueryable`1 source, String path)
       bei System.Data.Entity.QueryableExtensions.Include[T,TProperty](IQueryable`1 source, Expression`1 path)
       bei RpgTools.Characters.CharacterRepository.FindAll() in e:\Users\Robert\Documents\Visual Studio 2013\Projects\RpgTools\Modules\Characters\CharacterRepository.cs:Zeile 88.
       bei RpgTools.CharacterPresenter.ViewModels.CharactersViewModel.LoadCharacters() in e:\Users\Robert\Documents\Visual Studio 2013\Projects\RpgTools\Modules\CharacterPresenter\ViewModels\CharactersViewModel.cs:Zeile 169.
  InnerException: System.Data.Entity.Infrastructure.DbUpdateException …
Run Code Online (Sandbox Code Playgroud)

c# entity-framework

6
推荐指数
1
解决办法
2万
查看次数

Visual Studio构建调试配置但不构建发布配置

这个特殊问题很重要.

在我当前的配置中,如果Visual Studio 2013 处于Debug配置中,构建我的项目,但如果它处于Release配置中则不构建.

不知何故,当我选择版本160错误时,我会通过它们,他们在不可能的地方.这是一个例子.

Visual studio错误如下:

错误3; 预期E:\ Users\Robert\Documents\Visual Studio 2013\Projects\GW2.NET\GW2.NET\GW2.NET\V1\MapInformation\DataProvider\ContinentData.cs 96 36 GW2.NET

以下是有问题的代码:

public static async Task<T> GetContentAsync<T>(string apiMethod, List<KeyValuePair<string, object>> arguments, Categories category)
    {
        var response = await GetJsonAsync(apiMethod, arguments, category);

        return await Task.Factory.StartNew(() => JsonConvert.DeserializeObject<T>(response));
    }
Run Code Online (Sandbox Code Playgroud)

你看到没有错误,如果有一个Debug配置也不会构建.我已经尝试清理解决方案,从TFS获得最新信息.删除并重新创建配置.

现在我在我的智慧结束.有人可以帮我这个吗?

该项目是使用MS async,JSON.NET和Rest#packages的ac#4.0项目

tfs visual-studio c#-4.0 visual-studio-2013

5
推荐指数
2
解决办法
2万
查看次数

Rails:Grape API - NameError:未初始化的常量API

我目前正在学习如何使用Rails.我按照本网站上的教程:http: //funonrails.com/2014/03/building-restful-api-using-grape-in​​-rails/

我把我的文件放在lib文件夹中,但是在app文件夹中并按照教程中的说明编辑了application.rb.其余代码与教程中的相同.

我完成了它直到自定义错误格式化程序,但如果我启动Rails服务器测试一切我得到以下错误:

                Exiting
E:/Users/Robert/Documents/Rubymine Projects/WarframeApi/config/routes.rb:3:in `block in <top (required)>': uninitialized constant API (NameError)
    from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/routing/route_set.rb:337:in `instance_exec'
    from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/routing/route_set.rb:337:in `eval_block'
    from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/routing/route_set.rb:315:in `draw'
    from E:/Users/Robert/Documents/Rubymine Projects/WarframeApi/config/routes.rb:1:in `<top (required)>'
    from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
    from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/application/routes_reloader.rb:40:in `each'
    from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/application/routes_reloader.rb:40:in `load_paths'
    from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/application/routes_reloader.rb:16:in `reload!'
    from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/application/routes_reloader.rb:26:in `block in updater'
    from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/file_update_checker.rb:75:in `call'
    from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/file_update_checker.rb:75:in `execute'
    from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/application/routes_reloader.rb:27:in `updater'
    from C:in `execute_if_updated'
    from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/application/finisher.rb:71:in `block in <module:Finisher>'
    from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/initializable.rb:30:in `instance_exec'
    from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/initializable.rb:30:in `run'
    from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/initializable.rb:55:in `block in run_initializers'
    from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/tsort.rb:226:in …
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails

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

CaliburnMicro无法在不同的装配中找到视图模型的视图

最近我开始将我的一个项目重新组织成更小的组件.在一个步骤中,我将视图和视图模型移动到单独的程序集中,同时将视图和VM保持在一个通用程序集中.因此我的项目结构如下所示:

  • 主要
  • 核心
  • 模块< - 文件夹
    • CharacterPresenter
    • LocationPresenter

命名空间是这样的:

  • RpgTools
    • 主要
      • 的ViewModels
      • 查看
    • LocationPresenter
      • 的ViewModels
      • 查看
    • 其他项目遵循相同的系统.

"Main"包含bootstrapper和d minimalistic vm以及用于选择模块的视图.每个演示者都包含该演示者所需的所有视图和视图模型."Core"包含文件夹中每个项目使用的资产(例如元数据定义,导出接口等)

现在移动后Caliburn.Micro找不到视图模型的视图,无论它多么简单.以下是视图模型和视图的示例:

namespace RpgTools.LocationPresenter.ViewModels
{
    using System.ComponentModel.Composition;
    using RpgTools.Core.Contracts;

    [RpgModuleMetadata(Name = "Module C")]
    [Export(typeof(IRpgModuleContract))]
    public class ModuleCViewModel :IRpgModuleContract
    {
    }
}
Run Code Online (Sandbox Code Playgroud)
<UserControl x:Class="RpgTools.LocationPresenter.Views.ModuleCView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
            <TextBlock Text="ModuleC" />
    </Grid>
</UserControl>
Run Code Online (Sandbox Code Playgroud)

每次加载模块时都会出现以下错误:

找不到RpgTools.LocationPresenter.ViewModels.ModuleCViewModel的视图.

如果我将模型移回"Main",它可以正常工作.因为它可能是引导程序的一部分,所以它的完整代码是:

namespace RpgTools.Main
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel.Composition;
    using System.ComponentModel.Composition.Hosting;
    using System.ComponentModel.Composition.Primitives;
    using System.Diagnostics.CodeAnalysis;
    using System.IO;
    using System.Linq;
    using System.Reflection;
    using …
Run Code Online (Sandbox Code Playgroud)

c# mvvm caliburn.micro

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

Haskell初学者无法匹配预期的类型

我需要编写一个程序来解码一个包含四个值的列表,这些值可以是I或O的列表[Either Bool Bool].我知道我必须使用,但我根本无法绕过它.现在我完全绝望,因为我根本无法解决这个问题.

示例输入和输出可能如下所示:[I,O,O,I] => [Left True,Right False]

这是我目前的代码:

module Blueprint where
import Prelude
import Data.Maybe

data Bit = O | I  deriving (Eq, Show)

encode :: [Either Bool Bool] -> [Bit]
encode [] = []
encode l  = case head l of
            Left  False -> [I, I] ++ encode (tail l)
            Left  True  -> [I, O] ++ encode (tail l)
            Right False -> [O, I] ++ encode (tail l)
            Right True  -> [O, O] ++ encode (tail …
Run Code Online (Sandbox Code Playgroud)

haskell either maybe

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

将生成 IEnumerable&lt;T&gt; 的 TransformBlock 链接到接收 T 的块

我正在编写一个网络画廊抓取工具,我希望尽可能使用 TPL 数据流并行处理文件。

为了抓取,我首先获取图库主页并解析 HTML 以获取图像页面链接作为列表。然后我转到列表中的每个页面并解析 HTML 以获取图像的链接,然后将其保存到磁盘。

这是我的计划的概要:

var galleryBlock = new TransformBlock<Uri, IEnumerable<Uri>>(async uri =>
{
    // 1. Get the page
    // 2. Parse the page to get the urls of each image page
    return imagePageLinks;
});

var imageBlock = new TransformBlock<Uri, Uri>(async uri =>
{
    // 1. Go to the url and fetch the image page html
    // 2. Parse the html to retrieve the image url
    return imageUri;
});

var downloadBlock = ActionBlock<Uri>(async uri …
Run Code Online (Sandbox Code Playgroud)

c# parallel-processing asynchronous tpl-dataflow

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