小编The*_*der的帖子

引发了“Microsoft.TeamFoundation.Git.Contracts.GitCheckoutConflictException”类型的异常

在尝试签出 Visual Studio 2019 中的新分支时,我收到以下错误: 在此输入图像描述

我尝试GitBash cmd使用该命令执行相同的操作git checkout branchname,但在这里我也收到错误:

error: The following untracked working tree files would be overwritten by checkout:
//list of file names below
...
...
...
Aborting
Run Code Online (Sandbox Code Playgroud)

我也尝试过重新启动VS,但没有帮助。你能帮忙吗?

git visual-studio

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

使用 ARM 检索存储帐户连接字符串

我是编写 Azure 资源管理器模板的新手;我需要检索 Azure 存储帐户连接字符串。我可以使用[listKeys(variables('storageAccountId'), '2019-04-01').keys[0].value]where storageAccountIdis检索它的访问密钥,[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]但我无法为连接字符串(主要)这样做。

现在,我的问题是我们有listKeys检索访问密钥的功能,我们是否也有一些系统功能来检索连接字符串?还是我们需要连接并创建连接字符串?我有存储帐户名称和资源组名称的值。我如何使用 ARM 做到这一点?

azure-resource-manager

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

迭代并读取asp.net core中的所有appsettings键

我在我的 asp.net core 3.0 Web api 项目的 appsettings.json 文件中添加了一些配置,该文件如下所示:

{
  "Logging":{..},
  "AllowedHosts": "*",
  "Section1": {
     "Key1": "Value1",
     "Key2": "Value2",
     ....
  }
}
Run Code Online (Sandbox Code Playgroud)

我想迭代这个特定部分(Section1)中的所有键并对它们执行一些操作。我尝试了以下方法,但它不起作用:

foreach (var key in ConfigurationManager.AppSettings.AllKeys)
                {
                    var key = ConfigurationManager.AppSettings["Key1"];
                    // perform some action
                }
Run Code Online (Sandbox Code Playgroud)

ConfigurationManager.AppSettings不包含任何内容,如下面的屏幕截图所示: 在此输入图像描述

我还需要做什么才能使这项工作成功?

我已经尝试过该类型的var v = this._configuration.GetSection("Section1").GetSection("Key1");位置并且它按预期工作。但同样,就像我提到的,我不想要这个,相反,我想迭代应用程序设置中的所有键列表并对它们执行一些操作。_configurationIConfiguration

任何帮助都会很棒。

asp.net asp.net-web-api asp.net-core asp.net-core-webapi

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

使用“空格”分隔的属性名称反序列化 JSON

我需要反序列化一个 json,它的属性名称之间有一个“空格” (“关联团队”和“联系点”)。我尝试通过创建强类型对象来反序列化 json 字符串,但无法映射这 2 个属性。

JSON 字符串:(jsonString)

{
  "id": "/subscriptions/911yyy-1234-4695-a90f-943xxxxxxx/resourceGroups/sample",
  "name": "sample",
  "type": null,
  "properties": {
    "provisioningState": "Succeeded"
  },
  "location": "westus",
  "tags": {
    "Associated Team": "Sample Team",
    "Description": "Resource Group for Azure",
    "Point of Contact": "abc@xyz.com"
  }
}
Run Code Online (Sandbox Code Playgroud)

.Net 代码片段:

var deserializedResourceGroupDetails = JsonConvert.DeserializeObject<AzureResourceData>(jsonString);
Run Code Online (Sandbox Code Playgroud)

AzurResourceData.cs 类:

public class Tags
    {
        [JsonProperty("associatedTeam")]
        public string associatedTeam { get; set; }
        public string description { get; set; }
        [JsonProperty("pointOfContact")]
        public string pointOfContact { get; set; }
    }

    public class Properties …
Run Code Online (Sandbox Code Playgroud)

c# asp.net

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

adfs 和 azure AD 之间的区别

ADFS 和 Azure AD 之间的差异

  1. 据我了解,ADFS 是一种 STS(安全令牌服务),因为它向应用程序颁发令牌,帮助应用程序建立用户身份。在组织级别,我们的组织使用 ADFS 和 WS-Federation 协议来对组织所有内部应用程序中的用户进行身份验证,并实施 SSO。

  2. 此外,在我们的组织中,我们有 Azure AD 帐户,并且我使用 Azure AD 来注册我们的自定义应用程序,每当未经身份验证的用户进入我们的应用程序时,该人将重定向到 azure ad 登录页面,并且必须对自己进行身份验证。身份验证成功后,Azure AD 还会颁发令牌(ID 令牌、访问令牌、刷新令牌)

我的问题是,我是否可以将 Azure AD 视为一种 STS(安全令牌服务),就像 ADFS 一样,因为它会颁发令牌来建立客户端身份?

adfs azure ws-federation azure-active-directory

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

ng-multiselect-dropdown onDeSelectAll() 不起作用

我在我的角度代码中使用 ng-multiselect 下拉菜单。虽然所有 onSelect、onSelectAll、onDeSelect 方法都工作正常,但 onDeselctAll 方法不会接收取消选择的项目数组。我检查了官方网站,但没有用: https: //www.npmjs.com/package/ng-multiselect-dropdown。知道我哪里可能出错吗?PFB 代码片段:

.html 文件

<ng-multiselect-dropdown *ngIf="filteredSids.length > 0"
                                             [data]="filteredSids"
                                             [disabled]="false"
                                             [(ngModel)]="selectedSids"
                                             (onSelect)="selectedSIDs($event); onItemSelect($event)"
                                             (onSelectAll)="onSelectAll($event)"
                                             (onDeSelect)="onItemDeSelect($event)"
                                             (onDeSelectAll)="onDeSelectAll($event)"
                                             [settings]="dropdownSettings"
                                             formControlName="sidControl">
                    </ng-multiselect-dropdown>
Run Code Online (Sandbox Code Playgroud)

.ts 文件

onSelectAll(selectedSIDList: Array<string>): void {
        selectedSIDList.forEach(sid => {
            this.selectedSIDs(sid);
            this.onItemSelect(sid);
        });
    }

    onItemDeSelect(deselectedSID: any): void {
        this.selectedSIDList = this.selectedSIDList.filter(s => s != deselectedSID);

        this.selectedSIDList.forEach(sid => {
            this.onItemSelect(sid);
        });
    }

    onDeSelectAll(items: any){
        console.log(items); // items is an empty array
    }
Run Code Online (Sandbox Code Playgroud)

angular

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

对时间触发的 Azure 函数进行单元测试

我有一个时间触发的 Azure 函数,我想用 XUnit 和 MOQ 测试它。

虽然我知道我需要Run使用类的实例来调用该类的方法,但请说明funTimeTriggeredObj在哪里

funTimeTriggered funTimeTriggeredObj = new funTimeTriggered(queueSchedulerMock.Object, telemetryHelperMock.Object)
Run Code Online (Sandbox Code Playgroud)

喜欢

funTimeTriggeredObj.Run(param1, param2, loggerMock.Object) 
Run Code Online (Sandbox Code Playgroud)

在哪里

private Mock<ILogger> loggerMock = new Mock<ILogger>() 
Run Code Online (Sandbox Code Playgroud)

我不知道我应该怎么嘲笑param1param2它们TimerInfoExecutionContext分别的对象。

我问的原因是因为“TimerInfo”和“ExecutionContext”都没有实现任何可以模拟的接口。

下面是我的实际功能实现。任何帮助将不胜感激。

using System;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;

public  class funTimeTriggered
{
    private  string  _invocationID;
    private readonly IQueueScheduler _queueScheduler;
    private readonly ITelemetryHelper _telemetryHelper;

    public funTimeTriggered(IQueueScheduler queueScheduler, ITelemetryHelper telemetryHelper)
    {
        _queueScheduler = queueScheduler;
        _telemetryHelper = telemetryHelper;
    }

    [FunctionName("funTimeTriggered")]
    public  async Task …
Run Code Online (Sandbox Code Playgroud)

c# unit-testing xunit azure azure-functions

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

路径中的非法字符:Visual Studio 2019

我不知道为什么,但我只是突然无法运行我的 VS 2019 项目(Azure Functions v3 proj);表明

路径中的非法字符

在此处输入图片说明

这不是我正在使用的当前分支的问题;这是所有分支机构项目的问题。这也是项目一直成功运行的同一路径。重建,重新启动 VS,重新克隆项目,删除binobj文件夹的内容,然后再次运行 - 我已经尝试了一切,但没有任何帮助。我也尝试过修复甚至重新安装 VS,但没有帮助。.csproj 文件至少对我来说完全没问题:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <AzureFunctionsVersion>v3</AzureFunctionsVersion>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.ApplicationInsights" Version="2.13.1" />
    <PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.0.0" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="3.0.10" />
    <PackageReference Include="Microsoft.Extensions.Http" Version="3.1.2" />
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.6" />
  </ItemGroup>
  <ItemGroup>
    <None Update="host.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="local.settings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <CopyToPublishDirectory>Never</CopyToPublishDirectory>
    </None>
  </ItemGroup>
</Project>
Run Code Online (Sandbox Code Playgroud)

这篇文章也没有帮助:Visual Studio- Illegal characters in path

任何帮助都会非常有帮助。

c# visual-studio asp.net-core azure-functions visual-studio-2019

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

在 Azure 数据工厂 v2 中查找字符串长度

我从 ADFv2 开始,在尝试找出字符串的长度时遇到问题。尽管门户网站说length('abc')应该可以工作,但实际上并没有工作。解决这个问题的方法是什么?

PFB 错误快照: 在此输入图像描述

azure-data-factory

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

找不到类型或命名空间 EventProcessorClient

我从使用 .Net Core 的事件中心开始,在尝试编写与官方 MS 文档中相同的代码时遇到一个非常特殊的问题(https://learn.microsoft.com/en-us/azure/event- hubs/get-started-dotnet-standard-send-v2)。尽管我使用的事件接收器代码包含命名空间(即 Azure.Messaging.EventHubs),但它会引发错误。我这里哪里出错了?

在此输入图像描述

azure azure-eventhub

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

“bool”不包含“GetAwaiter”的定义

在尝试检查异步方法的结果时,我收到以下错误。

我既没有尝试await container.ExistsAsync().Result也没有bool result = await container.GetAwaiter().GetResult();工作。

我哪里错了?

[TestMethod]
public async Task StorageAccountConnectionTest()
{
    var storageCredentials = new StorageCredentials(_mockFuncXTransConfiguration.Object.StorageAccountName, _mockFuncXransConfiguration.Object.StorageAccountKey);
    var cloudStorageAccount = new CloudStorageAccount(storageCredentials, true);
    var cloudBlobClient = cloudStorageAccount.CreateCloudBlobClient();
    var container = cloudBlobClient.GetContainerReference(_mockFuncXTransConfiguration.Object.BlobName);
    bool result = await container.ExistsAsync().Result;
    Assert.AreEqual(true, result);
}
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

c# async-await

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