asp.net-mvc - Azure 云服务的保留 IP 地址不起作用

标签 asp.net-mvc azure azure-cloud-services static-ip-address

我正在尝试将保留的 IP 地址分配给云服务。我需要此功能来限制对数据库的 IP 访问(不,我不想允许所有 azure 节点进行此访问),并且我还必须访问需要静态 IP 的外部 API。

到目前为止,我已经创建了一个云服务解决方案,并向该解决方案添加了 MVC Web 角色。使用Azure Powershell,我获得了IP地址(通过使用GetAzureReservedIP验证成功)并更新了配置文件ServiceConfiguration.cloud.cscfg。

<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration serviceName="TestApp" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="4" osVersion="*" schemaVersion="2014-06.2.4">
  <Role name="MvcWebRole">
    <Instances count="1" />
    <ConfigurationSettings>
      <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="DefaultEndpointsProtocol=https;AccountName=XYZ;AccountKey=XYZ" />
    </ConfigurationSettings>
  </Role>
  <NetworkConfiguration>
    <AddressAssignments>
      <ReservedIPs>
        <ReservedIP name="MyReservedIP"/>
      </ReservedIPs>
    </AddressAssignments>
  </NetworkConfiguration>
</ServiceConfiguration>

(显然,我已经确保IP地址的名称与GetAzureReservedIP中显示的完全相同。)

使用此配置,我已将解决方案部署到新的云服务,但它没有收到预期的 IP 地址。 我正在使用 Visual Studio 2012 和 Azure SDK 2.4。我通过选择“生成”->“发布到 Azure”从 Visual Studio 部署到 Azure,在其中创建新的云服务并选择“云”服务配置。

编辑 我可以看到该 IP 地址未用于传出流量,因为无法访问数据库(仅允许使用一个 IP 地址)并且我对外部 Web 服务的请求被阻止。管理门户显示另一个IP地址被使用。

最佳答案

根据我个人在AZure上的使用经验,如果你尝试使用vip在云服务上分配保留IP,是行不通的。您可以分配到新的云服务或无需任何部署的云服务(vip尚未分配)。

另请注意,基于关联组的云服务上的保留 IP 存在限制,在这种情况下您可能会遇到以下问题:

New-AzureVM : BadRequest : The deployment contains VirtualNetwork DemoVNET that belongs to an Affinity Group and ReservedIP that belongs to a region. This combination is not allowed.   

引用:http://azure.microsoft.com/blog/2014/05/14/reserved-ip-addresses/

关于asp.net-mvc - Azure 云服务的保留 IP 地址不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25249887/

相关文章:

.net - 云服务回收时出现错误 System.IO.FileLoadException : Could not load file or assembly 'System. Web.Http,版本=4.0.0.0

Azure 自动缩放应用程序 block - 有什么意义?

asp.net-mvc - 仅为未经身份验证的用户缓存内容

javascript - 在 MVC 中通过 JavaScript 提交动态生成的表单

Azure 事件网格触发器函数重试 500

azure - 在单个 ARM 脚本中创建批量帐户和 Key Vault

javascript - 从 onClick() 加载完整 View

c# - MVC Action 中神秘的长度参数

.net - Azure Application Insights 是否提供任何内置方法来匿名化用户数据?

azure - 按内存自动缩放Azure云服务