Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
是否可以从Azure网站访问Azure中的表存储_Azure_Azure Table Storage - Fatal编程技术网

是否可以从Azure网站访问Azure中的表存储

是否可以从Azure网站访问Azure中的表存储,azure,azure-table-storage,Azure,Azure Table Storage,我想从Azure网站(不是云服务)使用Azure表存储服务。有关于如何使用Node.js实现这一点的指南,但我喜欢使用.NETMVC NET的所有指南都谈到在ServiceConfiguration中存储Azure存储连接信息(就像在云服务中一样),但在Azure网站中我没有这个(只有一个Web.config)。如果我没有弄错的话,在没有在Azure emulator中运行的情况下使用RoleEnvironment(用于读取ServiceConfiguration)也是不可能的,我不会在Azur

我想从Azure网站(不是云服务)使用Azure表存储服务。有关于如何使用Node.js实现这一点的指南,但我喜欢使用.NETMVC

NET的所有指南都谈到在ServiceConfiguration中存储Azure存储连接信息(就像在云服务中一样),但在Azure网站中我没有这个(只有一个Web.config)。如果我没有弄错的话,在没有在Azure emulator中运行的情况下使用RoleEnvironment(用于读取ServiceConfiguration)也是不可能的,我不会在AzureWeb站点中这样做

是否可以从Azure网站访问表存储?如果可以,我如何连接到它


我已经看过了,但看起来不一样。

简短回答:是的。表服务具有,这意味着您可以从任何可以通过http进行通信的客户端平台访问它

谷歌随后提供了大量的例子:


您可以使用MVC中的
CloudTableClient
:即使大多数示例是针对云服务的,您也可以轻松地调整它们以从web.config或任何其他源获取连接数据。如何在此处创建文档:

您只需从web.config获取连接字符串并对其进行解析(请注意,您还可以使用
CloudConfigurationManager.GetSetting
方法):

在web.config中,您需要添加如下连接字符串:

  <appSettings>
    <add key="myStorageAccountConnectionString" value="DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=fazfazefazefzeefazeefazfazefazef"/>
  </appSettings>


谢谢,对于我来说,这在看指南时并不明显。是否也可以使用本地开发存储(通过设置UseDevelopmentStorage=true并以某种方式启动Azure Emulator)?是。您可以如下方式启动存储仿真器:
C:\Program Files\Microsoft SDK\Windows Azure\emulator\csrun.exe/devstore:start
  <appSettings>
    <add key="myStorageAccountConnectionString" value="DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=fazfazefazefzeefazeefazfazefazef"/>
  </appSettings>