2

I have a MVC2 App which also includes a Non MVC part (regular Asp.Net 3.5 pages).

I am calling webservice (Not WCF) from Non MVC pages to populate autocompletes.

Both MVC parts and Non-MVC parts work fine in my developers machine.

When i host my application in IIS, i cant access the webmethods in my webservice. I checked with firebug it returns

The controller for path '/payroll/WS/MVCArch.asmx/JqUiGetEmp' was not found or does not implement IController. '

Here my virtual directory name is Payroll. and my Non MVC pages are located under a folder called "RepDocs" which is under the root of the application. My Webservice folder "WS" is also under the root of the application. The request was sent from a non mvc page under "RepDocs" folder.

How come the same code works in VSHOST and not in IIS (XP sp3) ? am i missing something ?

Please help.

EDIT

I have modified my global.asax to exclude routes as follow

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("favicon.ico");
routes.IgnoreRoute("WS/{resource}.asmx/{*pathInfo}");
//routes.IgnoreRoute("{*allasmx}", new { allasmx = @".*\.asmx(/.*)?" });
routes.MapRoute(
    "Default", // Route name
    "{controller}/{action}/{id}", // URL with parameters
    new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);

Now i get this error

The HTTP verb POST used to access path '/Payroll/ws/MVCArch.asmx/JqUiGetOffice' is not allowed.

I added the following to the Web.config

<webServices>
    <protocols>
      <add name="HttpGet"/>
      <add name="HttpPost"/>
      </protocols>
</webServices>

Still no luck.

Deb
  • 981
  • 13
  • 39
  • Your path is probably wrong for deployment. See http://blogs.msdn.com/b/rickandy/archive/2011/04/22/test-you-asp-net-mvc-or-webforms-application-on-iis-7-in-30-seconds.aspx -- – RickAndMSFT Jul 20 '12 at 15:20
  • i checked with the path and wsdl returns correctly which means my service is up and running. The pages render too correctly. Only thing does not work is ajax request to my service. somehow the request ends up with controller which should not be as the request is originated from non mvc page. – Deb Jul 20 '12 at 15:30

1 Answers1

2

You have to ignore the route to the web service in Global.asax.cs

routes.IgnoreRoute("{*allasmx}", new {allasmx=@".*\.asmx(/.*)?"});
VJAI
  • 32,167
  • 23
  • 102
  • 164
  • After using your suggestion i get System.Web.HttpException: The HTTP verb POST used to access path '/payroll/ws/MVCArch.asmx/JqUiGetOffice' is not allowed. – Deb Jul 20 '12 at 17:44