身份登录功能停止了托管的Blazor Wasm Asp.net核心的工作

时间:2020-09-01 08:30:54

标签: identityserver4 asp.net-core-3.1 blazor-webassembly

我一直在与blazor wasm asp.net核心托管项目一起玩了几个星期,昨天我在服务器端添加了一些控制器,并且一切正常(也已登录)。今天回到身份服务器刚刚停止登录?我可以大张旗鼓地访问api(从而访问数据库),但是当我进入标识的登录页面并与用户登录时,iis会关闭..没有日志,不知道为什么。我可以注册用户,除了登录外,我几乎可以做其他任何事情。

登录后,在调试日志控制台中看到的最后一件事是:

  "Name": "Token Issued Success",
  "Category": "Token",
  "EventType": "Success",
  "Id": 2000,
  "ClientId": "MyProject.Client",
  "ClientName": "MyProject.Client",
  "RedirectUri": "https://localhost:44367/authentication/login-callback",
  "Endpoint": "Authorize",
  "SubjectId": "d0053d07-e530-4e49-acfe-dd9a35a18d12",
  "Scopes": "openid profile MyProject.ServerAPI",
  "GrantType": "authorization_code",
  "Tokens": [
    {
      "TokenType": "code",
      "TokenValue": "****so1w"
    }
  ],
  "ActivityId": "80000012-0000-fa00-b63f-84710c7967bb",
  "TimeStamp": "2020-09-01T07:57:14Z",
  "ProcessId": 23820,
  "LocalIpAddress": "::1:44367",
  "RemoteIpAddress": "::1"
}
The program '' has exited with code -1 (0xffffffff).
The thread 0x0 has exited with code 0 (0x0).
The program 'localhost:44367' has exited with code -1 (0xffffffff).
The program '[23820] iisexpress.exe' has exited with code -1 (0xffffffff).

有人可能会想到为什么突然开始发生这种情况吗?

我已经读到它可能与sdk引用有关,以便尽可能完整,我为客户端,服务器和共享项目添加了.csproj文件。

服务器:


  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <UserSecretsId>MyProject.Server-1C8DF269-9BED-44E5-A7A0-C94CD6D45333</UserSecretsId>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="3.2.1" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.7" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" />
    <PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="5.5.1" />
    <PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="5.5.1" />
    <PackageReference Include="Swashbuckle.AspNetCore.SwaggerUi" Version="5.5.1" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\Client\MyProject.Client.csproj" />
    <ProjectReference Include="..\Shared\MyProject.Shared.csproj" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="3.1.7" />
    <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.7" />
    <PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="3.1.7" />
    <PackageReference Include="Microsoft.AspNetCore.ApiAuthorization.IdentityServer" Version="3.1.7" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.7" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.7">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
  </ItemGroup>

</Project>

客户:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netstandard2.1</TargetFramework>
    <RazorLangVersion>3.0</RazorLangVersion>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.1" />
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="3.2.1" PrivateAssets="all" />
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="3.2.1" PrivateAssets="all" />
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="3.2.1" />
    <PackageReference Include="Microsoft.Extensions.Http" Version="3.1.7" />
    <PackageReference Include="System.Net.Http.Json" Version="3.2.1" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\Shared\MyProject.Shared.csproj" />
  </ItemGroup>

</Project>

共享:


  <PropertyGroup>
    <TargetFramework>netstandard2.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" />
    <PackageReference Include="System.Text.Json" Version="4.7.2" />
  </ItemGroup>

</Project>

更新:

经过更多研究,我发现这仅在chrome浏览器中发生。

更新2:

尝试了所有我可以找到的相同站点cookie的配置选项,这些选项也不起作用,还尝试配置openIdConfiguration,但那也不起作用。

0 个答案:

没有答案
相关问题