我的应用程序必须处理存储在 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 库中的错误还是我遗漏了什么?
我想使用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-name和collection-name。其他参数失败并显示此错误:
az : ERROR: az: error: unrecognized arguments: --url-connection:https://myaccount.documents.azure.com:443
--key:secretKey
Run Code Online (Sandbox Code Playgroud) 我尝试在 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) 我的部署分为两个管道
我的 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
我尝试将大表转换为天蓝色的 SQL Server。\n虽然小表已完成,但大表尚未完成,并且落在超时接收器一侧。\n附加了错误。\n而 sql 服务器未完成\xe2\x80 \x99t 指定了任何超时,但它仍然无法工作。
\nsql 数据库是 800 DTU。
\n如果这是问题的话,我如何增加接收器端的超时。
\n数据工厂不应该保存连接并在失败时重试吗?
\nerrors:\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) 将我的 ServiceFabric 集群更新到 6.5 版后,我的应用程序开始弹出警告。
带有 ExplicitPort 27000 的端点 MyEndpoint 在应用程序端口范围内。这可能会导致端口冲突。请从应用程序端口范围之外选择一个端口。
为什么会发生此错误,我需要做什么来修复它?
由于该类是一次性的,我以某种方式认为它可能应该用作单例。我应该如何安全地使用它?
// 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() 线程安全问题的重复,因为它专门讨论设置密钥的不同线程,而我在每次调用中都使用相同的密钥。重读之后,它可能仍然是重复的。坐等各位大佬的意见。
azure ×5
c# ×2
.net ×1
azure-cli ×1
libtiff.net ×1
memorystream ×1
powershell ×1
tiff ×1
timeout ×1