将MVC应用程序发布到Azure失败,出现ERROR_NOT_SUPPORTED错误

问题描述 投票:1回答:1

我想通过Visual Studio 2017将MVC应用程序发布到Azure App Servis。但是发布失败并出现ERROR_NOT_SUPPORTED错误。 img:https://i.imgur.com/f8Z5W0A.png

在tmp文件(由错误消息标记)中出现以下消息:

System.AggregateException: One or more errors occurred. ---> System.Exception: Publish failed due to build errors. Check the error list for more details.
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at Microsoft.VisualStudio.Web.Publish.PublishService.VsWebProjectPublish.<>c__DisplayClass40_0.<PublishAsync>b__2()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()

我尝试更改Azure Web App常规设置(Frame Work版本,平台...)并将所有应用程序设置从Web.config添加到My Azure App服务,但没有帮助。我的MVC应用程序具有以下Web.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" />
  </configSections>
  <appSettings>
    <add key="IsInTestMode" value="false" />
    <add key="UseDB" value="..." />
    <add key="StoredProcedureNamePrefix" value="..." />
    <add key="NumberOfRetriesAtTransactionDeadlock" value="20" />
  </appSettings>
  <connectionStrings>
    <add name="ProductionConnectionString" connectionString="Data Source=...." />
  </connectionStrings>
  <system.web>
    <customErrors mode="Off" />
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
    <authentication mode="Windows" />
    <globalization requestEncoding="utf-8" responseEncoding="utf-8" />
    <caching>
      <outputCacheSettings>
        <outputCacheProfiles>
          <add name="LongTime" duration="7200" varyByParam="none" />
        </outputCacheProfiles>
      </outputCacheSettings>
    </caching>
    <authorization>
      <deny users="?" />
    </authorization>
    <pages>
      <namespaces>
        <add namespace="System.Web.Helpers" />
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Optimization" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Web.WebPages" />
      </namespaces>
    </pages>
    <sessionState timeout="3" />
  </system.web>
  <system.webServer>
    <urlCompression doStaticCompression="true" doDynamicCompression="true" />
    <httpCompression>
      <dynamicTypes>
        <add mimeType="application/json" enabled="true" />
        <add mimeType="application/json; charset=utf-8" enabled="true" />
      </dynamicTypes>
    </httpCompression>

  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e3" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <nlog autoReload="true" throwExceptions="true" internalLogFile="${basedir}/Logs/internal_log.txt" internalLogLevel="Trace">
    <!--......-->
  </nlog>
</configuration>

在IIS Manager.Net授权规则中启用“匿名用户,条目类型:本地”命令后,我成功地将我的应用程序安装到Azure虚拟机IIS并且它运行时没有任何复杂性。使用deafult“Deny”设置应用程序失败并显示“Acces denied”消息。

有人遇到了相同的情况或有任何线索可能是什么问题或如何解决这个问题?

asp.net-mvc azure visual-studio-2017 azure-web-sites publish
1个回答
0
投票

我可以解决我的问题。在项目中,wpp.targets文件设置了“DeployIisAppPath”。我从wpp.targets文件中删除后:

<DeployIisAppPath> Default Web Site/... </DeployIisAppPath>

我可以发布我的Web应用程序。

谢谢您的帮助。

© www.soinside.com 2019 - 2024. All rights reserved.