Andy Stannard
Andy Stannard

Reputation: 1703

404 on MVC / webform app when accessing a service

I integrated MVC3 into my webforms app using Scott Hanselmans article: http://www.hanselman.com/blog/IntegratingASPNETMVC3IntoExistingUpgradedASPNET4WebFormsApplications.aspx

All ways good and seemed to work fine when running locally on my pc. However when this has been deployed to testing the following URL breaks the app giving me a 404: http://testserver/portal/Services/SEBService.asmx/SEBSearch

if I put in just: http://testserver/portal/Services/SEBService.asmx it sees the service

scratching my head I tried the following fix in global.asax:

public static void RegisterRoutes(RouteCollection routes)
{
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
        routes.IgnoreRoute("{resource}.asmx/{*pathInfo}");
}

Alas still broken :( Any thoughts, fixes, recommendations would be greatly appreciated

Upvotes: 4

Views: 1026

Answers (2)

Robert Bolton
Robert Bolton

Reputation: 673

I had to update my web.config with the following.

<system.webServer>
    <handlers>
      <remove name="asmx" />

      <add name="asmx" verb="*" path="*.asmx" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </handlers>
</system.webServer>

Upvotes: 2

Andy Stannard
Andy Stannard

Reputation: 1703

fixed with this:

routes.Ignore("{*allasmx}", new { allasmx = @".*\.asmx(/.*)?" });

very odd how it worked on some machines and not others but with the above included it works on all machines.

Upvotes: 15

Related Questions