13

Our ASP.NET Web Api project has two deployment configurations (.pubxml):

  1. Web deployment directly to Azure Websites.
  2. Package deployment to a local Zip file.

The Web deployment (1) works just fine. The Package deployment to a zip is failing with the following errors:

Warning 3   No element in the source document matches '/configuration/system.identityModel'     20  10  MyWebProject
Error   4   No element in the source document matches '/configuration/system.identityModel/identityConfiguration'       21  10  MyWebProject

Looking at the verbose logs, I can see it's failing during the Web.config transform.

        ParameterizeTransformXml:   No element in the source document matches '/configuration/appSettings/add[@key='ida:AudienceUri']'
        ParameterizeTransformXml:   Not executing SetTokenizedAttributes (transform line 7, 9)
        ParameterizeTransformXml:   No element in the source document matches '/configuration/appSettings/add[@key='ida:Realm']'
        ParameterizeTransformXml:   Not executing SetTokenizedAttributes (transform line 10, 9)
        ParameterizeTransformXml:   No element in the source document matches '/configuration/appSettings/add[@key='ida:FederationMetadataLocation']'
        ParameterizeTransformXml:   Not executing SetTokenizedAttributes (transform line 13, 9)
 Warning : No element in the source document matches '/configuration/system.identityModel'
        ParameterizeTransformXml:   Not executing RemoveAll (transform line 24, 14)
 Error : No element in the source document matches '/configuration/system.identityModel/identityConfiguration'
        ParameterizeTransformXml:   Not executing Insert (transform line 27, 9)
        ParameterizeTransformXml:   No element in the source document matches '/configuration/system.identityModel'
        ParameterizeTransformXml:   Not executing SetTokenizedAttributes (transform line 33, 9)
        ParameterizeTransformXml:   No element in the source document matches '/configuration/system.identityModel.services'
        ParameterizeTransformXml:   Not executing SetTokenizedAttributes (transform line 42, 9)
        ParameterizeTransformXml:   No element in the source document matches '/configuration/system.identityModel.services'
        ParameterizeTransformXml:   Not executing SetTokenizedAttributes (transform line 45, 9)
        ParameterizeTransformXml: Transformation failed
        Done executing task "ParameterizeTransformXml" -- FAILED.
        Done building target "_TransformWebConfigForAzureAuthenticationCore" in project "MyWebProject.csproj" -- FAILED.
Done building project "MyWebProject.csproj" -- FAILED.

What additional build information do I need to configure to get the Zip deployment past these errors? It works just fine if I do a direct web deployment.

4

5 回答 5

27

检查您的发布设置以查看您是否已将 EnableADPublish 设置为 true。那是我的问题(我正在通过其他方式配置 Azure AD Auth),所以我将其设置为 false 并且一切正常。

<EnableADPublish>false</EnableADPublish>

干杯,杰夫

于 2015-03-30T17:30:41.867 回答
3

如果您使用的是发布向导,请确保未选中“启用组织身份验证”**。这为我修好了。

在此处输入图像描述

于 2016-08-18T19:53:28.043 回答
2

我明确添加了以下配置:

<system.identityModel>
    <identityConfiguration>
      <audienceUris>        
      </audienceUris>
    </identityConfiguration>
</system.identityModel>

它终于可以创建包了!

于 2016-10-05T06:52:02.443 回答
0

您在 AD 集成的配置中缺少 system.identityModel 元素。如果要与 azure AD 集成,则需要在配置中启用 Windows Identity Foundation (WIF) 选项

<configuration>
  <configSections>
    <!--WIF 4.5 sections -->
    <section name="system.identityModel" type="System.IdentityModel.Configuration.SystemIdentityModelSection, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <section name="system.identityModel.services" type="System.IdentityModel.Services.Configuration.SystemIdentityModelServicesSection, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
  </configSections>

  ...

  <system.identityModel>
    <identityConfiguration>
      <audienceUris>
        <add value="http://localhost/WebApplication1/" />
      </audienceUris>
      <issuerNameRegistry type="System.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089">
        <trustedIssuers>
          <add thumbprint="313D3B … 9106A9EC" name="SelfSTS" />
        </trustedIssuers>
      </issuerNameRegistry>
      <certificateValidation certificateValidationMode="None"/>
    </identityConfiguration>
  </system.identityModel>

  ...

</configuration>
于 2016-05-31T16:19:52.943 回答
0

我知道这已经很老了,但我刚刚遇到了这个问题,唯一为我解决的方法是从 Azure Web 应用程序概览刀片的“获取发布配置文件”按钮重新下载发布配置文件。然后我不得不将它导入到解决方案中。

希望对某人有所帮助!

于 2017-10-17T16:31:20.950 回答