我使用Azure存储模拟器版本在Windows 10-x64和WindowsAzure.Storage 9.1.1上测试asp.net核心2.1-rc1 Web应用程序。
我已按照本指南设置Azure存储模拟器。
https://docs.microsoft.com/en-us/azure/storage/common/storage-use-emulator
当我尝试创建blob容器时,我得到了这个异常:
"The MAC signature found in the HTTP request 'NeZGAEspShTRdpc/zFH++pS9YChlOczzEg0vcVGXF10=' is not the same as any computed signature. Server used following string to sign: 'PUT\n\n\n\n\n\n\n\n\n\n\n\nx-ms-client-request-id:e4b5b43c-ba27-45b1-8545-19db1c16a160\nx-ms-date:Wed, 23 May 2018 19:10:31 GMT\nx-ms-version:2017-07-29\n/devstoreaccount1/admins\nrestype:container'."
我在异常附加信息中找到了这个: -
public static async Task InitializeContainersAsync()
{
try
{
//Use the emulator default credenitals
var credentials = new StorageCredentials("devstoreaccount1", "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==");
CloudStorageAccount storageAccount = new CloudStorageAccount(credentials, false);
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer container = blobClient.GetContainerReference("testing_container");
await container.CreateIfNotExistsAsync();
}
catch (StorageException ex)
{
Console.WriteLine(ex);
}
}
这是我的代码: -
#include<stdio.h>
int * range(int a, int b);
main()
{
int *r;
int j;
r = range(0,5);
printf("%d",r[0]); // getting the first one to check array but not working
// instead showing segmantation fault
}
int * range(int a, int b) {
int last[b];
int i,j;
for(i=a;i<b;i++){
last[i] = i;
}
return last;
}
答案 0 :(得分:2)
如果您想使用存储模拟器,实际上有两个选项。
UseDevelopmentStorage=true
。从应用程序连接到存储模拟器的最简单方法是在应用程序的配置文件中配置引用快捷方式UseDevelopmentStorage = true的连接字符串。以下是app.config文件中存储模拟器的连接字符串示例:
<appSettings>
<add key="StorageConnectionString" value="UseDevelopmentStorage=true" />
</appSettings>
要创建引用模拟器帐户名和密钥的连接字符串,必须在连接字符串中为模拟器指定要使用的每个服务的端点。这是必要的,以便连接字符串将引用模拟器端点,这些端点与生产存储帐户的端点不同。例如,连接字符串的值如下所示:
DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;
AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;
BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;
TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;
QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;