Plz Help - Publishing Web API with Webforms not working

Discussion in 'ASP.NET / ASP.NET Core' started by jzahoor, Jan 11, 2015.

  1. I have a ASP.Net web forms application to which I have added Web API. I did this by creating a new Web Application via VS2013 (Update 4). I checked the Web API option during the creation process and it created the appropriate config files and global.asax entries.

    Routes work when debugging locally but after publishing to DASP and trying to access a controller url, I get a HTTP 404 message.

    Any ideas?

    My web.config has the following section setup:
    <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
    <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
    <remove name="OPTIONSVerbHandler" />
    <remove name="TRACEVerbHandler" />
    <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    <add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
    </handlers>
    <modules>
    <remove name="ApplicationInsightsWebTracking" />
    <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Extensibility.Web.RequestTracking.WebRequestTrackingModule, Microsoft.ApplicationInsights.Extensibility.Web" preCondition="managedHandler" />
    </modules>
    </system.webServer>
     
    Last edited: Jan 11, 2015
  2. Fixed! The issue was in the publishing of code. Do not precompile when publishing and it works!
     
    martino and mjp like this.
  3. mjp

    mjp

    Thanks for posting a follow up, that will help someone else down the line.
     

Share This Page