小编CJ *_*ten的帖子

当 cookie 存在时,OIDC 登录失败,并显示“关联失败”-“未找到 cookie”

我正在使用 IdentityServer 4 通过外部登录提供商 (Microsoft) 为我的 Web 应用程序提供身份验证和自动授权。

当我在本地运行 IdentityServer 和我的 Web 应用程序时,这工作得很好。但是,当我将 Identityserver 项目发布到 Azure 时,它​​不再起作用。

当我将本地运行的 Web 应用程序连接到已发布的 IdentityServer 时,从 Microsoft 登录页面返回后,该 Web 应用程序失败并显示错误“关联失败”。未知地点”。

Web 应用程序的输出显示:

Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler: 
Warning: '.AspNetCore.Correlation.oidc.xxxxxxxxxxxxxxxxxxx' cookie not found.

Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler: 
Information: Error from RemoteAuthentication: Correlation failed..
Run Code Online (Sandbox Code Playgroud)

但是,当我检查浏览器时,确实存在一个名称为“.AspNetCore.Correlation.oidc.xxxxxxxxxxxxxxxxxxx”的 cookie。

这是网络应用程序中的startup.cs:

public class Startup
{
    public Startup(IConfiguration configuration)
    {
        Configuration = configuration;
    }

    public IConfiguration Configuration { get; }

    // This method gets called by the runtime. Use this method to add services to the container.
    public …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-core identityserver4

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

在活动内容之上叠加工具栏

我正在使用AppCompat v21库在我的Android应用程序中创建一个类似Lollipop的界面.
到目前为止,它运作良好.

现在我想在我的一个活动中将工具栏显示在我的内容之上.
但是,我无法让它发挥作用.这是我到目前为止:

活动布局:

<LinearLayout
    android:id="@+id/main_parent_view"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:theme="@style/myAppTheme">
    <include layout="@layout/toolbar_setlist_top"/>
    <ImageView
        android:id="@+id/image"
        android:layout_height="match_parent"
        android:layout_width="match_parent"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

工具栏布局:

<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/toolbar"
    app:theme="@style/MyActionBar"
    app:popupTheme="@style/MyActionBar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minHeight="?attr/actionBarSize"
    android:layout_marginTop="0dp" />
Run Code Online (Sandbox Code Playgroud)

主题:

<resources>
    <style name="myAppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="colorPrimary">@color/primaryColor</item>
        <item name="colorPrimaryDark">@color/primaryColorDark</item>
        <item name="android:windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
        <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
        <item name="android:activatedBackgroundIndicator">@drawable/list_selector</item>
        <item name="actionBarStyle">@style/MyActionBar</item>
    </style>

    <style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
        <item name="spinBars">true</item>
        <item name="color">@android:color/white</item>
    </style>

    <style name="MyActionBar" parent="@style/Widget.AppCompat.ActionBar">
        <item name="android:background">@color/primaryColor2</item>
        <item name="android:windowActionBarOverlay">true</item>
        <!-- Support library compatibility -->
        <item name="background">@color/primaryColor2</item>
        <item name="windowActionBarOverlay">true</item>
    </style>
</resources>
Run Code Online (Sandbox Code Playgroud)

码:

@Override …
Run Code Online (Sandbox Code Playgroud)

android android-appcompat

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

获取 OpenGL 最大纹理大小

我正在开发一个可以广泛使用位图的 Android 应用程序,我正在寻找一种可靠的方法来在不同设备上获得 OpenGL 的最大纹理大小。
我知道最小尺寸 = 2048x2048,但这还不够好,因为已经有分辨率更高的平板电脑(例如 2560x1600)
那么有没有可靠的方法来获取这些信息?

到目前为止,我已经尝试过:

  • Canvas.getMaximumBitmapWidth()(返回 32766,而不是 2048)
  • GLES10.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE ...)(返回 0)

我正在使用 minimum-sdk = 15 (ICS) 并且我正在 Asus Transformer TF700t Infinity 上测试它

有谁知道另一种获得它的方法吗?或者我是否必须编译已知 GPU 的最大画布大小列表?

android opengl-es

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

实体框架查询失败“任务已取消。”

我有一个 ASP Core 3.1 Web 项目,我想向其中添加 EntityFramework Core。
我创建了一个数据库上下文,即具有数据库操作的模型类,并将其注入到我的主类(Azure Bot)中。

但是,当我尝试将记录插入数据库时​​,它总是失败并出现错误

System.Threading.Tasks.TaskCanceledException:“任务已取消。”

这是我的startup.cs:

services.AddDbContext<IVRContext>(options =>
            options.UseSqlServer(
                Configuration.GetConnectionString("DefaultConnection"),
                optionBuilder => optionBuilder.EnableRetryOnFailure()
            )
        );
        services.AddTransient<IVRCallModel>();
Run Code Online (Sandbox Code Playgroud)

这是我正在调用的 IVRModel 中的函数:

 public async Task InsertCallAsync(IVRCall call)
    {
        try
        {
            await _ivrContext.Calls.AddAsync(call);
            await _ivrContext.SaveChangesAsync();
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message, ex);
        }
    }
Run Code Online (Sandbox Code Playgroud)

我就是这样称呼它的:

private async Task NotificationProcessor_OnNotificationReceivedAsync(NotificationEventArgs args)
{
    this.GraphLogger.CorrelationId = args.ScenarioId;
    if (args.ResourceData is Call call)
    {
        if (call.Direction != CallDirection.Outgoing && call.ToneInfo == null)
        {
            if (args.ChangeType == ChangeType.Created && call.State …
Run Code Online (Sandbox Code Playgroud)

c# entity-framework-core .net-core

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