小编Lun*_*Dev的帖子

VS Code中的jQuery intellisense

我试过这个:

Visual Studio Code中的JQuery intellisense

还有这个:

http://shrekshao.github.io/2016/06/20/vscode-01/

但它没有做任何事,VS Code只是不会添加jquery intellisense,我一直试图解决这个问题几个小时但它只是不起作用

intellisense jquery visual-studio-code

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

获取 Microsoft Graph API 的有效访问令牌

我正在开发一个 ASP.NET MVC5 Web 应用程序,它使用 Azure ADAL 库对用户进行身份验证,它工作正常,但是,当我手动向图形发送请求时,例如:GET https://graph.microsoft.com/v1.0 /me或 GET https://graph.microsoft.com/v1.0/groups ?$filter=from/displayName eq 'whatever'。

我尝试更新 Azure 中的应用程序注册以添加所需的图形权限,并且我还尝试创建新的应用程序注册,无论我做什么,我的请求将始终响应 401 未经授权,我是否缺少任何内容?

编辑:邮递员的响应示例

{
  "error": {
    "code": "InvalidAuthenticationToken",
    "message": "Access token validation failure.",
    "innerError": {
      "request-id": "a142576b-acce-4e59-8a8d-adede61aaf59",
      "date": "2017-04-05T13:27:36"
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

编辑:C# 请求示例

public async Task<GroupGraph> GetGroupIdByDisplayName(string displayName)
{
    var accessToken = await authenticationService.GetTokenUserOnly();
    GroupGraph groupGraphResponse = null;
    using (var client = new HttpClient())
    {
        using (var request = new HttpRequestMessage(HttpMethod.Get, $"https://graph.microsoft.com/v1.0/groups?$filter=from/displayName eq '{displayName}'"))
            {
                request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken); …
Run Code Online (Sandbox Code Playgroud)

azure access-token oauth-2.0 azure-active-directory microsoft-graph-api

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

访问 blob uri 时出现 ResourceNotFound

我试图通过 Azure Blob 存储中的 URL 检索图像,但没有找到它,这是我得到的:

在此处输入图片说明

我的代码如下:

public async Task<bool> UploadFileAsync(string containerReference, string blobReference, string route)
    {
        CloudBlobContainer container = blobClient.GetContainerReference(containerReference);
        container.CreateIfNotExists();
        CloudBlockBlob blob = container.GetBlockBlobReference(blobReference);

        try
        {
            using (var fileStream = System.IO.File.OpenRead(route))
            {
                await blob.UploadFromStreamAsync(fileStream);
            }
        }
        catch (System.Exception)
        {
            return false;
        }

        return true;
    }
Run Code Online (Sandbox Code Playgroud)

它成功地将文件上传到 blob:

在此处输入图片说明

然后我尝试检索其 URL 以直接访问它:

public string GetBlobUrl(string containerReference, string blobReference)
    {
        CloudBlobContainer container = blobClient.GetContainerReference(containerReference);
        CloudBlockBlob blob = container.GetBlockBlobReference(blobReference);

        return blob.Uri.ToString();
    }
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

c# azure azure-storage azure-storage-blobs azure-blob-storage

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

使用C#中的Json.net格式化Json

我试图将一堆XML文件解析为一个已经正常工作的JSON文件.

最终的JSON文件如下所示:

{
"items": [
    {
        "subItems": [
            {
                "Name": "Name",
                "Value": "Value",
                "Type": "text"
            },
            {
                "Name": "Name",
                "Value": "Value",
                "Type": "text"
            }
        ]
    },
    {
        "subItems": [
            {
                "Name": "Name",
                "Value": "Value",
                "Type": "text"
            },
            {
                "Name": "Name",
                "Value": "Value",
                "Type": "text"
            },
...
Run Code Online (Sandbox Code Playgroud)

相反,我想实现以下结构:

{
"items": [
    [   
        {
            "Name": "Name",
            "Value": "Value",
            "Type": "text"
        },
        {
            "Name": "Name",
            "Value": "Value",
            "Type": "text"
        }

    ],
    [
        {
            "Name": "Name",
            "Value": "Value",
            "Type": "text"
        },
        {
            "Name": "Name", …
Run Code Online (Sandbox Code Playgroud)

c# json jsonserializer json.net json-serialization

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