2017-04-04 51 views
2

我开始使用Azure功能进行开发。我已经能够连接到我的实际Azure存储帐户队列,以测试如何使用Azure功能进行编程。现在我的下一步是使用Microsoft Azure存储资源管理器来使用本地存储帐户,因此我不必连接到azure。我看到如何做到这一点在这篇文章中:如何访问本地PC上的仿真Azure存储

ScriptHost initialization failed Microsoft.WindowsAzure.Storage: The remote server returned an error: (403) Forbidden.

有没有人遇到这样的:https://docs.microsoft.com/en-us/azure/storage/storage-configure-connection-string#create-a-connection-string-to-the-storage-emulator

in the appsettings.json I changed my values to this exactly: 
{ 
    "IsEncrypted": false, 
    "Values": { 
    "AzureWebJobsStorage": "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==", 
    "AzureWebJobsDashboard": "", 
    "StorageConnectionString": "UseDevelopmentStorage=true" 

    } 
} 

当我使用Visual Studio我得到这个错误信息启动了Azure的Fuctions CLI?

+0

这里有一个关于这博客:https://blog.kloud.com.au/2016/12/02/debugging-azure-functions-in-our-local-box/ 提琴手可能捕捉为什么有用的信息请求失败 –

回答

4

请更改下面的代码行:

"AzureWebJobsStorage": "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==" 

要么:

"AzureWebJobsStorage": "UseDevelopmentStorage=true" 

或:

"AzureWebJobsStorage": "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;" 

这应该采取403错误的照顾。

基本上存储模拟器与云存储帐户有不同的端点。例如,云存储帐户的默认blob端点为http://[youraccount].blob.core.windows.net,而存储模拟器的blob端点为http://127.0.0.1:10000。当您只需在连接字符串中为存储模拟器指定存储帐户名称和密钥时,存储客户端库将其视为云存储帐户,并尝试使用您提供的帐户密钥连接到http://devstoreaccount1.blob.core.windows.net。由于devstoreaccount1在云中的密钥不是您提供的密钥,因此您得到了403错误。

+0

感谢您添加“AzureWebJobsStorage”:“UseDevelopmentStorage = true”。我很困惑如何使用它。 – greektreat

相关问题