Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/13.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 ACS配置_Azure_Wif_Acs_Azure Acs - Fatal编程技术网

用于本地和生产的Azure ACS配置

用于本地和生产的Azure ACS配置,azure,wif,acs,azure-acs,Azure,Wif,Acs,Azure Acs,配置Azure ACS以便在开发结构中本地运行时仍然可以进行身份验证的最佳方法是什么 我只想配置一次,就可以在本地开发并发布到azure,而无需更改配置。我甚至愿意在本地开发时不使用联邦身份验证,只要我能以某种方式伪造声明。您可以使用Web.Config和Web.Release.Config(每个构建配置的转换文件)。 Config用于您的本地开发,其中您有指向您的本地地址的领域、受众URL,即127.0.0.1。 然后,您可以为Web.Config编写转换文件,例如Web.Release.Co

配置Azure ACS以便在开发结构中本地运行时仍然可以进行身份验证的最佳方法是什么


我只想配置一次,就可以在本地开发并发布到azure,而无需更改配置。我甚至愿意在本地开发时不使用联邦身份验证,只要我能以某种方式伪造声明。

您可以使用
Web.Config
Web.Release.Config
(每个构建配置的转换文件)。 Config用于您的本地开发,其中您有指向您的本地地址的领域、受众URL,即127.0.0.1。 然后,您可以为
Web.Config
编写转换文件,例如
Web.Release.Config
,您可以在其中编写转换,用实际部署URL替换上述值。我假设您将使用发布版本来部署到azure

这就是您的web.config.release的外观

<microsoft.identityModel>
    <service>
      <audienceUris>
        <add value="https://abc.cloudapp.net/" xdt:Transform="Replace" />
      </audienceUris>
      <serviceCertificate xdt:Transform="Insert">
        <certificateReference x509FindType="FindByThumbprint" findValue="AAAAAAAAAAAAAAAAAAAAAAAAAAA" storeLocation="LocalMachine" storeName="My" />
      </serviceCertificate>
      <federatedAuthentication>
        <wsFederation passiveRedirectEnabled="true" issuer="https://myacs.accesscontrol.windows.net/v2/wsfederation" realm="https://abc.cloudapp.net/" requireHttps="true" xdt:Transform="Replace" />
        <cookieHandler requireSsl="true" xdt:Transform="Replace" />
      </federatedAuthentication>
    </service>   </microsoft.identityModel>

最简单的方法是像bhavesh所说的那样使用配置转换,尽管他发布的web.config自Net4.5以来已经过时了

您可以在
web.config
中进行本地开发配置,在
web.Debug.config
中进行云开发配置,在
web.Release.config
中进行生产配置

下面是一个示例web.Debug.config(仅适用于相关部分):


现在剩下要做的就是为ACS门户中的每个配置配置一个依赖方

实际上,您可以为所有3种配置配置一个RP,但实现这一点的唯一方法是以编程方式使用服务管理API,因为门户仅允许您为每个依赖方配置一个领域/返回URL值


请注意,如果您决定这样做,您必须在web.config(
reply
属性)中设置返回url,否则ACS将始终使用第一个配置的返回url(您在门户中看到的url)覆盖它。

谢谢您的回答。我已经尝试过这个解决方案,但我想知道是否还有其他方法可以解决这个问题。我应该在帖子里提到这一点,这是我的方式。这不是一个“变通办法”。这就是解决本地生产困境的方法。@astaykov使用本地STS怎么样?我试着四处搜索,但没有找到太多关于它的信息。我不会使用本地STS。配置和管理太多麻烦。。。尽管您(目前)可以拥有任意数量的ACS名称空间,而且ACS中的所有内容都是免费的。另外,即使使用本地STS,您仍然需要进行这些web.config转换。使用本地STS不会获得任何收益,除非您通常离线开发。这是我选择本地STS的唯一原因。
<system.identityModel>
  <identityConfiguration>
    <audienceUris>
      <add xdt:Transform="RemoveAll" />
      <add value="http://myinstance.cloudapp.net/" xdt:Transform="Insert" />
    </audienceUris>
  </identityConfiguration>
</system.identityModel>

<system.identityModel.services>
  <federationConfiguration >
    <cookieHandler requireSsl="false" />
    <wsFederation passiveRedirectEnabled="true" issuer="https://mynamespace.accesscontrol.windows.net/v2/wsfederation" realm="http://myinstance.cloudapp.net/" reply="http://myinstance.cloudapp.net/" requireHttps="false" xdt:Transform="Replace"/>
  </federationConfiguration>
</system.identityModel.services>