小编aBl*_*aze的帖子

TypeScript - Puppeteer 库错误:“找不到名称‘元素’”

我已将其puppeteer-core作为依赖项包含在我的 TypeScript 项目中,并且正在使用 Visual Studio 2019。当我尝试构建项目时,出现以下错误(如 下的红色波浪下划线所示Element):

在此处输入图片说明

错误 TS2304:构建:找不到名称“元素”

请问我该如何解决?

typescript puppeteer

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

当函数发布到云时,阻止 Azure blob 触发器函数在现有 blob 上触发

我有一个在 blob 触发器上启动的 Azure 函数。有趣的是,如果我将此 Azure Function 的更新版本发布到云,并且如果已经存在 Blob,则将在这些已存在的 Blob 上触发 Azure Function。

这不是我想要的功能。相反,我希望新发布的 Azure 函数仅在新上传的 blob 上触发,而不是在已存在的 blob 上触发。如何禁用对现有 blob 的触发?

triggers azure azure-storage-blobs azure-blob-storage azure-functions

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

JetBrains Rider:如何附加到本地运行的提升权限进程?

我正在 Linux 上使用 JetBrains Rider 来调试一些 .NET 核心服务。我在没有权限的情况下启动了 Rider sudo,因为我的代码源树全部位于我的本地用户下,但已安装的服务却在root权限下运行。

现在我陷入了困境,为了附加到正在运行的进程,我必须使用 启动一个新的 Rider 实例sudo,但这会弄乱源代码树。总的来说,这是一个巨大的痛苦。

我希望能够通过在没有sudo. 我认为下面是执行此操作的方法:运行 - >附加到远程进程,这会弹出以下弹出窗口:

在此输入图像描述

但是,此弹出窗口的问题是,如果我单击 上的箭头root@localhost:22,则它显示没有要附加的进程。然而,我想要附加 4 个进程(在屏幕截图中,它们是 14949-14952)。如何获得“没有可附加的进程”来列出有问题的 4 个进程?我以前见过另一个开发人员这样做过,只是觉得我错过了一些东西。另外,我 100% 确定我知道 root 密码。

rider

7
推荐指数
0
解决办法
1511
查看次数

Chrome DevTools:Network.loadingFinished 和 Network.dataReceived 事件之间有什么区别?

我想知道:

  1. Network.loadingFinished事件的目的是什么?当文档说“HTTP 请求完成加载时触发”时,到底是什么意思?
  2. 此事件与请求的最后一个 Network.dataReceived事件有何不同?

起初,我的印象是 Network.loadingFinished 事件表示特定请求的加载时间结束,其中“加载时间”定义为收到最后一个有效负载数据包的时间。但是,如果这是 true,则 Network.loadingFinished 的时间戳和最后一个 Network.dataReceived 的时间戳将相等;然而,事实并非如此。

下面是最后一个 Network.dataReceived 事件的时间戳大于 Network.loadingFinished 事件的时间戳的示例:

在此输入图像描述

这是相反情况的一个例子:

在此输入图像描述

google-chrome-devtools chrome-devtools-protocol

6
推荐指数
0
解决办法
785
查看次数

错误:命名空间“System.Web”中不存在类型或命名空间名称“Configuration”

我正在尝试使用https://learn.microsoft.com/en-us/azure/key-vault/key-vault-use-from-web-application中的以下代码

//add these using statements
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using System.Threading.Tasks;
using System.Web.Configuration;

//this is an optional property to hold the secret after it is retrieved
public static string EncryptSecret { get; set; }

//the method that will be provided to the KeyVaultClient
public static async Task<string> GetToken(string authority, string resource, string scope)
{
    var authContext = new AuthenticationContext(authority);
    ClientCredential clientCred = new ClientCredential(WebConfigurationManager.AppSettings["ClientId"],
            WebConfigurationManager.AppSettings["ClientSecret"]);
    AuthenticationResult result = await authContext.AcquireTokenAsync(resource, clientCred);

    if (result == null)
        throw new InvalidOperationException("Failed to obtain the …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc azure-active-directory azure-keyvault

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

Azure AD B2C 错误:请求中指定的客户端 ID 未在租户中注册

我正在尝试登录 Azure Active Directory B2C 应用程序。

每当我访问 URL 时https://login.microsoftonline.com/te/<my_domain>/<my_sign_up_sign_in_policy_name>/oauth2/v2.0/authorize?client_id=<my_client_id>...,都会出现以下错误:

<my_client_id>请求中指定的客户端 ID未在租户中注册<my_tenant_name>

以下是有关我的配置的一些信息:

  • 在 中https://portal.azure.com,我创建了包含用户的 Azure Active Directory B2C 租户globaladmin@<my_domain>.onmicrosoft.com

    • 为了创建应用程序,我导航到https://apps.dev.microsoft.com,以全局管理员身份登录并按照此处说明创建了“Web Portal v2”应用程序
  • 我授予了 Web Portal v2 对 Microsoft Graph 的访问权限,但未授予对 Azure AD Windows Graph API 的访问权限(我在任何地方都没有看到此选项) 在此处输入图片说明

  • 我可以成功导航到https://portal.azure.com-> 查找 Azure AD B2C 资源 -> 点击进入 -> 应用程序。还有新创建的“Web Portal v2”

在此处输入图片说明

我的应用程序已更新为“Web Portal v2”的新 ClientId 和 ClientSecret。但是,当我启动应用程序并单击“登录”时,出现错误。我还缺少什么其他配置?

此外,我应该补充一点,上述所有配置的原因是我可以将我的应用程序从使用 Azure AD V1 令牌迁移到 Azure AD V2 令牌,其中包含诸如 …

oauth-2.0 azure-ad-b2c microsoft-graph-api

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

如何使用\ u导航到URL?

我遇到过其中包含\ u Unicode字符的URL,例如以下内容(请注意,这不会映射到有效页面 - 这只是一个示例).

http://my_site_name.com/\u0442\uab86\u0454\uab8eR-\u0454\u043d-\u043c/23795908

如何使用Python对这样的URL进行解码/编码,以便我可以成功地执行HTTP GET以从此网页检索数据?

python url character-encoding python-3.x

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

如何使用登录用户的 AccessToken 实例化 Microsoft GraphClient?

我的 Startup.Auth.cs 如下所示:

public partial class Startup
{
    private static string clientId = ConfigurationManager.AppSettings["ida:ClientId"];
    private static string appKey = ConfigurationManager.AppSettings["ida:ClientSecret"];
    private static string aadInstance = ConfigurationManager.AppSettings["ida:AADInstance"];
    private static string tenantId = ConfigurationManager.AppSettings["ida:TenantId"];
    private static string postLogoutRedirectUri = ConfigurationManager.AppSettings["ida:PostLogoutRedirectUri"];

    public static readonly string Authority = aadInstance + tenantId;

    // This is the resource ID of the AAD Graph API.  We'll need this to request a token to call the Graph API.
    string graphResourceId = "https://graph.microsoft.com";

    public void ConfigureAuth(IAppBuilder app)
    {
        ApplicationDbContext …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc azure-active-directory adal microsoft-graph-api

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

`[Authorize(Roles = "admin")]` 无限循环 ASP.NET MVC 和 Azure Active Directory B2C

我尝试仅允许具有“全局管理员”角色的 Azure Active Directory B2C 用户访问以下类(这就是我包含该Authorize命令的原因):

[Authorize(Roles = "admin")]
public class UserProfileController : Controller
{
    ... controller class ...
}
Run Code Online (Sandbox Code Playgroud)

我的 Startup 类如下所示:

public partial class Startup
{
    private static string clientId = ConfigurationManager.AppSettings["ida:ClientId"];
    private static string appKey = ConfigurationManager.AppSettings["ida:ClientSecret"];
    private static string aadInstance = ConfigurationManager.AppSettings["ida:AADInstance"];
    private static string tenantId = ConfigurationManager.AppSettings["ida:TenantId"];
    private static string postLogoutRedirectUri = ConfigurationManager.AppSettings["ida:PostLogoutRedirectUri"];
    // This is the resource ID of the AAD Graph API.  We'll need this to request a token to call …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc azure oauth-2.0

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

Puppeteer 有没有办法从 Chrome 网络标签中获取确切的数据?

我正在尝试使用 Puppeteer 导航到 URL 并从 Chrome 开发人员工具的网络选项卡中提取指标。例如,导航到此页面会显示以下网络信息,并捕获总共 47 个请求。 在此处输入图片说明

但是,我正在尝试使用以下代码获取这些指标:

import { Browser, Page } from "puppeteer";

const puppeteer = require('puppeteer');

async function run() {
    const browser: Browser = await puppeteer.launch({
        headless: false,
        defaultViewport: null
    });

    const page: Page = await browser.newPage();
    await page.goto("/sf/ask/2131917511/");

    let performanceTiming = JSON.parse(
        await page.evaluate(() => JSON.stringify(window.performance.getEntries()))
    );

    console.log(performanceTiming);
}

run();
Run Code Online (Sandbox Code Playgroud)

但是,当我performanceTiming查看该对象时,它只有 34 个项目: 在此处输入图片说明

因此,我的问题是:

  1. 为什么“网络”选项卡与performance.getEntries()显示的请求数量不同?
  2. 是否可以performance.getEntries()显示所有请求而不是仅显示其中的一部分?
  3. Puppeteer 是否可以从“网络”选项卡中获取所有数据?

javascript node.js google-chrome-devtools puppeteer

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