小编Ale*_*AIT的帖子

通过 LibTiff.Net 从 Stream 加载的 Tiff 没有字段值

我的应用程序必须处理存储在 MemoryStream 中的 TIFF 文件,但 LibTiff.Net 始终返回null字段值。

        MemoryStream ms = new MemoryStream();
        FileStream fs = new FileStream("testfile.tif", FileMode.Open);
        fs.CopyTo(ms);

        //It seems (memory) streams have to be opened in write mode, "r" always returns <null>
        Tiff tiff = Tiff.ClientOpen("someArbitraryName", "w", ms, new TiffStream());

        FieldValue[] imageHeight = tif.GetField(TiffTag.IMAGELENGTH);
Run Code Online (Sandbox Code Playgroud)

直接打开文件进行读取Tiff.Open效果很好。

这是 LibTiff.Net 库中的错误还是我遗漏了什么?

.net c# tiff memorystream libtiff.net

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

如何为 Azure CLI 使用 Powershell splatting

我想使用Powershell splatting有条件地控制用于某些 Azure CLI 调用的参数。专门用于创建 CosmosDb 集合。

目标是这样的:

$params = @{
    "db-name" = "test";
    "collection-name"= "test2";
    # makes no difference if I prefix with '-' or '--'
    "-key" = "secretKey";
    "url-connection" = "https://myaccount.documents.azure.com:443"
    "-url-connection" = "https://myaccount.documents.azure.com:443"
}

az cosmosdb collection create @params
Run Code Online (Sandbox Code Playgroud)

不幸的是,这只适用于db-namecollection-name。其他参数失败并显示此错误:

az : ERROR: az: error: unrecognized arguments: --url-connection:https://myaccount.documents.azure.com:443 
--key:secretKey
Run Code Online (Sandbox Code Playgroud)

powershell azure azure-cli

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

通过ARM模板创建.NET 5 Function App后“服务不可用”

我尝试在 ARM 模板中复制以下 Azure CLI 命令。它基于文档并且工作正常。

az functionapp create --resource-group AzureFunctionsQuickstart-rg --p myappserviceplan --runtime dotnet-isolated --runtime-version 5.0 --functions-version 3 --name <APP_NAME> --storage-account <STORAGE_NAME> --os-type linux
Run Code Online (Sandbox Code Playgroud)

但是,当执行下面的 ARM 模板时,打开 https://<APP_NAME>.azurewebsites.net 后得到的只是Service unavailable. 如果我使用 AZ 命令,我会看到Your Functions 3.0 app is up and running. 通过 Azure Pipelines 发布我的函数func azure functionapp publish似乎在大多数情况下都会超时,尤其是使用 Azure Function App 任务的 Azure Pipelines。

我需要改变什么?

az functionapp create --resource-group AzureFunctionsQuickstart-rg --p myappserviceplan --runtime dotnet-isolated --runtime-version 5.0 --functions-version 3 --name <APP_NAME> --storage-account <STORAGE_NAME> …
Run Code Online (Sandbox Code Playgroud)

azure azure-resource-manager azure-functions

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

Azure Function+ARM:将应用程序设置与当前设置合并

我的部署分为两个管道

  1. 部署基础设施(运行ARM模板)
  2. 部署和配置应用程序(上传应用程序、运行脚本)

我的 ARM 模板包含一个 AppSettings 数组,如下所示:

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
        // ...
  },
  "variables": {
    "functionAppName": "[parameters('appName')]",
    "storageAccountid": "[concat(resourceGroup().id,'/providers/','Microsoft.Storage/storageAccounts/', parameters('storageAccountName'))]"
  },
  "resources": [
    {
      "apiVersion": "2015-08-01",
      "type": "Microsoft.Web/sites",
      "name": "[variables('functionAppName')]",
      "location": "[parameters('location')]",
      "kind": "functionapp",
      "dependsOn": [],
      "properties": {
        "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]",
        "siteConfig": {
          "appSettings": [
            {
              "name": "AzureWebJobsStorage",
              "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', parameters('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountid'),'2015-05-01-preview').key1)]"
            },
            {
              "name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING",
              "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', parameters('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountid'),'2015-05-01-preview').key1)]"
            },
            {
              "name": "WEBSITE_CONTENTSHARE",
              "value": "[toLower(variables('functionAppName'))]"
            },
            {
              "name": "FUNCTIONS_EXTENSION_VERSION",
              "value": "~2"
            }, …
Run Code Online (Sandbox Code Playgroud)

azure azure-resource-manager azure-web-app-service azure-functions

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

天蓝色数据工厂-超时接收器端

我尝试将大表转换为天蓝色的 SQL Server。\n虽然小表已完成,但大表尚未完成,并且落在超时接收器一侧。\n附加了错误。\n而 sql 服务器未完成\xe2\x80 \x99t 指定了任何超时,但它仍然无法工作。

\n

sql 数据库是 800 DTU。

\n

如果这是问题的话,我如何增加接收器端的超时。

\n

数据工厂不应该保存连接并在失败时重试吗?

\n
errors:\n{\n    "dataRead": 1372864152,\n    "dataWritten": 1372864152,\n    "sourcePeakConnections": 1,\n    "sinkPeakConnections": 2,\n    "rowsRead": 2205634,\n    "rowsCopied": 2205634,\n    "copyDuration": 8010,\n    "throughput": 167.377,\n    "errors": [\n        {\n            "Code": 11000,\n            "Message": "Failure happened on \'Sink\' side. \'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Timeouts in SQL write operation.,Source=Microsoft.DataTransfer.ClientLibrary,\'\'Type=System.Data.SqlClient.SqlException,Message=Execution Timeout Expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.,Source=.Net SqlClient Data Provider,SqlErrorNumber=-2,Class=11,ErrorCode=-2146232060,State=0,Errors=[{Class=11,Number=-2,State=0,Message=Execution Timeout Expired.  The timeout period elapsed prior to completion …
Run Code Online (Sandbox Code Playgroud)

timeout azure azure-data-factory

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

ServiceFabric 警告“具有 ExplicitPort 的端点在应用程序端口范围内。这可能会导致端口冲突。”

将我的 ServiceFabric 集群更新到 6.5 版后,我的应用程序开始弹出警告。

带有 ExplicitPort 27000 的端点 MyEndpoint 在应用程序端口范围内。这可能会导致端口冲突。请从应用程序端口范围之外选择一个端口。

为什么会发生此错误,我需要做什么来修复它?

azure azure-service-fabric

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

为什么 HMACSHA256 ComputeHash 不是线程安全的

由于该类是一次性的,我以某种方式认为它可能应该用作单例。我应该如何安全地使用它?

        // Code uses Nuget package FluentAssertions
        var key = "supersecret";
        var keybytes = Encoding.UTF8.GetBytes(key);
        var hmac = new HMACSHA256(keybytes);

        var tokenBytes = Encoding.UTF8.GetBytes("tokentocompute");
        var expected = hmac.ComputeHash(tokenBytes);

        await Task.WhenAll(
            Enumerable.Range(0, 100).Select(i => Task.Run(() =>
            {
                var hash = hmac.ComputeHash(tokenBytes);
                // This throws most of the time
                hash.ShouldBeEquivalentTo(expected, $"{i}");
            }))
        );
Run Code Online (Sandbox Code Playgroud)

我不认为它是HMACSHA1.ComputeHash() 线程安全问题的重复,因为它专门讨论设置密钥的不同线程,而我在每次调用中都使用相同的密钥。重读之后,它可能仍然是重复的。坐等各位大佬的意见。

c# thread-safety

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