Iis7 .net webservice 404 error

asp.nethandler-mappingsiis-7web services

I have a webservice /test/Service1.asmx in the same folder as a page /test/test.aspx.

The page works fine but I get the message bellow for the services in the same location. I know the file is there and the url is correct, and I have added the script module and managed handler as well. If anyone knows what I'm missing here I'd appreciate it

Server Error in '/' Application.


The resource cannot be found.
Description: HTTP 404. The resource
you are looking for (or one of its
dependencies) could have been removed,
had its name changed, or is
temporarily unavailable. Please
review the following URL and make sure
that it is spelled correctly.

Requested URL: /test/Service1.asmx


Version Information: Microsoft .NET
Framework Version:2.0.50727.4200;
ASP.NET Version:2.0.50727.4016

FAILED REQUEST LOG:
ModuleName ManagedPipelineHandler
Notification 128
HttpStatus 404
HttpReason Not Found
HttpSubStatus 0
ErrorCode 0
ConfigExceptionInfo
Notification EXECUTE_REQUEST_HANDLER
ErrorCode The operation completed successfully. (0x0)

Best Answer

I encountered this issue while doing some test migrations of our intranet applications from IIS6 to 7. I was able to solve the problem by modifying the following section of the Web.config file:

<system.webServer>
   <validation validateIntegratedModeConfiguration="false"/>
   <modules>
      <remove name="ScriptModule"/>
   </modules>
   <handlers>
      <remove name="WebServiceHandlerFactory-Integrated"/>
      <remove name="ScriptHandlerFactory"/>
      <remove name="ScriptHandlerFactoryAppServices"/>
      <remove name="ScriptResource"/>
   </handlers>
</system.webServer>

Change validateIntegratedModeConfiguration to true, and remove the WebServiceHandlerFactory-Integrated from the remove list.

Oddly enough, from memmory ASP.NET adds those lines specifically IIS7. Oh well.