'How to load web resource files correctly?

I'm having trouble loading web resource (.axd) files correctly. When I run the project locally, I'm not getting any errors, but when deploying to Azure app service it is giving me a 500 error.

My app service is configured using ASP.NET V4.8 and IIS10.0 as seen below:

enter image description here

enter image description here

The errors I'm receiving in the console of the app are:

enter image description here

Lastly, my web.config file:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings>
    <add key="FromEmail" value="classified"/>
    <add key="MailPort" value="25"/>
    <add key="UseCredentials" value="false"/>
    <add key="EmailFromAddress" value="{{{youremailaddresshere}}}"/>
    <add key="EnableEmail" value="False"/>
    <add key="Environment" value="Dev"/>
    <add key="MailServer" value="classified"/>
    <add key="SupportEmailAddress" value="{{{youremailaddresshere}}}"/>
    <add key="AzureAccountName" value="classified"/>
    <add key="AzureAccountKey" value="classified"/>
    <add key="AzureAccountContainerName" value="classified"/>
    <add key="Telerik.ScriptManager.TelerikCdn" value="Enabled" />
    <add key="Telerik.StyleSheetManager.TelerikCdn" value="Enabled" />
  </appSettings>
  <!-- Connection Strings -->
  <connectionStrings>
    <!-- classified -->
  </connectionStrings>
  <system.net>
    <!-- Mail Settings-->
    <mailSettings>
      <smtp from="">
        <network host="{{{your mail host name}}}" password="{{{pwdhere}}}" userName="{{{youremailaddresshere}}}"/>
      </smtp>
    </mailSettings>
  </system.net>
  <system.web>
    <customErrors mode="Off"/>
    <httpRuntime maxRequestLength="102400" executionTimeout="3600" requestValidationMode="2.0" relaxedUrlToFileSystemMapping="true"/>
    <sessionState mode="InProc" timeout="90"/>
    <!-- Role Manager -->
    <roleManager enabled="true" defaultProvider="SqlProvider">
      <providers>
        <clear/>
        <add name="SqlProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="classified" applicationName="classified"/>
      </providers>
    </roleManager>
    <compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      </assemblies>
    </compilation>
    <pages controlRenderingCompatibilityVersion="4.0" clientIDMode="AutoID">
      <namespaces>
        <clear/>
        <add namespace="System"/>
        <add namespace="System.Collections"/>
        <add namespace="System.Collections.Generic"/>
        <add namespace="System.Collections.Specialized"/>
        <add namespace="System.Configuration"/>
        <add namespace="System.Text"/>
        <add namespace="System.Text.RegularExpressions"/>
        <add namespace="System.Linq"/>
        <add namespace="System.Xml.Linq"/>
        <add namespace="System.Web"/>
        <add namespace="System.Web.Caching"/>
        <add namespace="System.Web.SessionState"/>
        <add namespace="System.Web.Security"/>
        <add namespace="System.Web.Profile"/>
        <add namespace="System.Web.UI"/>
        <add namespace="System.Web.UI.WebControls"/>
        <add namespace="System.Web.UI.WebControls.WebParts"/>
        <add namespace="System.Web.UI.HtmlControls"/>
      </namespaces>
      <controls>
        <add tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI"/>
      </controls>
    </pages>
    <!--
            The <authentication> section enables configuration 
            of the security authentication mode used by 
            ASP.NET to identify an incoming user. 
        -->
    <authentication mode="Forms">
      <forms loginUrl="default.aspx" timeout="90"/>
    </authentication>
    <httpHandlers>
      <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false"/>
      <add path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" validate="false"/>
      <add path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" validate="false"/>
      <add path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" validate="false"/>
      <add path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" validate="false"/>
      <add verb="GET,HEAD" path="ScriptResource.axd"   
    type="System.Web.Handlers.ScriptResourceHandler,   
    System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,   
    PublicKeyToken=31bf3856ad364e35" validate="false" /> 
    </httpHandlers>
    <!-- Membership Provider-->
    <membership defaultProvider="MySqlProvider" userIsOnlineTimeWindow="15">
      <providers>
        <clear/>
        <!-- classified -->
      </providers>
    </membership>
    <!-- Site Map Provider-->
    <siteMap defaultProvider="MainSiteMap">
      <providers>
        <add name="MainSiteMap" type="System.Web.XmlSiteMapProvider" siteMapFile="~/Web.sitemap" securityTrimmingEnabled="true"/>
        <add name="AdminSiteMap" type="System.Web.XmlSiteMapProvider" siteMapFile="~/admin/Web.sitemap" securityTrimmingEnabled="true"/>
      </providers>
    </siteMap>
    <httpModules/>
  </system.web>
  <!-- 
        The system.webServer section is required for running ASP.NET AJAX under Internet
        Information Services 7.0.  It is not necessary for previous version of IIS.
    -->
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <handlers>
      <remove name="ChartImage_axd"/>
      <remove name="Telerik_Web_UI_SpellCheckHandler_axd"/>
      <remove name="Telerik_Web_UI_DialogHandler_aspx"/>
      <remove name="Telerik_RadUploadProgressHandler_ashx"/>
      <remove name="Telerik_Web_UI_WebResource_axd"/>
      <add name="Telerik_Web_UI_WebResource_axd" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" preCondition="integratedMode"/>
      <add name="Telerik.ReportViewer.axd_*" path="Telerik.ReportViewer.axd" verb="*"
        type="Telerik.ReportViewer.WebForms.HttpHandler, Telerik.ReportViewer.WebForms, Version=4.2.10.1110, Culture=neutral, PublicKeyToken=a9d7983dfcc261be"
        preCondition="integratedMode"/>
      <add name="Telerik_RadUploadProgressHandler_ashx" path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*"
        preCondition="integratedMode"/>
      <add name="ChartImage_axd" path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" preCondition="integratedMode"/>
      <add name="Telerik_Web_UI_SpellCheckHandler_axd" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*"
        preCondition="integratedMode"/>
      <add name="Telerik_Web_UI_DialogHandler_aspx" path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*"
        preCondition="integratedMode"/>
    <add name="webresources" verb="Get" path="WebResource.axd"
   type="System.
   Web.Handlers.AssemblyResourceLoader" />
    </handlers>
    <modules runAllManagedModulesForAllRequests="true"/>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="104857600"/>
      </requestFiltering>
    </security>
  </system.webServer>
  <location path="admin" inheritInChildApplications="true">
    <system.web>
      <authorization>
        <allow roles="classified"/>
        <deny users="*"/>
      </authorization>
      <identity impersonate="true"/>
    </system.web>
  </location>
  <location path="agencyadmin" inheritInChildApplications="true">
    <system.web>
      <authorization>
        <allow roles="classified"/>
        <deny users="*"/>
      </authorization>
    </system.web>
  </location>
  <location path="agents" inheritInChildApplications="true">
    <system.web>
      <authorization>
        <allow roles="classified"/>
        <allow roles="classified"/>
        <deny users="*"/>
      </authorization>
    </system.web>
  </location>
  <location path="users" inheritInChildApplications="true">
    <system.web>
      <authorization>
        <allow roles="classified"/>
        <allow roles="classified"/>
        <allow roles="classified"/>
        <deny users="*"/>
      </authorization>
    </system.web>
  </location>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Telerik.Web.UI" publicKeyToken="121fae78165ba3d4" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-2012.1.215.40" newVersion="2012.1.215.40"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="itextsharp" publicKeyToken="8354ae6d2174ddca" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-5.5.13.2" newVersion="5.5.13.2"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs"
        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/>
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
    </compilers>
  </system.codedom>
</configuration>

I figured out how to enable detailed error messages in my app service and have narrowed it down furthur:

enter image description here

When I looked at the contents of the web.config file in the WebResource.axd directory, it did indeed only contain the characters "asdf".

Why would that be the case?

I'm not sure how to go about fixing this and I've tried all the solutions that I could find online, but none of them solve this problem for me.

How can I go about fixing this configuration issue?

Any and all help is greatly appreciated!

Thank you.



Solution 1:[1]

Cause:

This problem occurs because the ApplicationHost.config or Web.config file contains a malformed or unidentified XML element. IIS can't identify the XML elements of the modules that are not installed. For example, IIS URL Rewrite module.

Resolution:

Use one of the following methods:

  • Delete the malformed XML element from the ApplicationHost.config or Web.config file.
  • Check the unidentified XML elements, and then install the relevant IIS modules.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 samwu