Search code examples
wcfrouteshttphandlersvc

HTTPHandler and svc


I've got an existing web application, that is installed on several machines. script clients and .net clients consume ".asmx" services through one machine, that routes all calls to other machines.

Client ----> |Website \ Virtual directory(HttpHandler)| ----> |Other server \ real .asmx|

I added a new .svc service that does the same functionality, and added a handler for it (directory's config):

<system.webServer>
<handlers>
  <add name="MY_ASMX" verb="*" path="*.asmx" type="MY.AO.HttpProxy, Astea.AO.HttpProxy" resourceType="Unspecified" preCondition="integratedMode" />
  <add name="MY_ASPX" verb="*" path="*.aspx" type="MY.AO.HttpProxy, Astea.AO.HttpProxy" resourceType="Unspecified" preCondition="integratedMode" />
  <add name="MY_WSDL" verb="*" path="*.wsdl" type="MY.AO.HttpProxy, Astea.AO.HttpProxy" resourceType="Unspecified" preCondition="integratedMode" />
  <add name="MY_SVC" verb="*" path="*.svc" type="MY.AO.HttpProxy, Astea.AO.HttpProxy" resourceType="Unspecified" preCondition="integratedMode" />

while asmx request are routed fine, my new .svc on the end server does not get called, and even the Httphandler is skipped. if i call the .svc directly on the other machine it works.

the error i get is:

WebHost failed to process a request.
Sender Information: System.ServiceModel.Activation.HostedHttpRequestAsyncResult/26458746
 Exception: System.Web.HttpException (0x80004005): The service '/Mysite/MyDirectory/settings.svc' does not exist. ---> System.ServiceModel.EndpointNotFoundException: The service '/Mysite/MyDirectory/settings.svc' does not exist.

I already tried the folowing

  1. add "buildProviders" to compilation section that removes .svc
  2. Click on MimeTypes and enter “.svc” and “application/octet-stream” and save
  3. add a handler :

nothing helps, http handler is not being called

p.s. Im working with AppPool .net 4.0 Integrated


Solution

  • .svc extensions are considered by default to be WCF services, and handlers/modules are already present for them. You can remove the existing handlers/modules by putting a element before your <add> element:

    <remove name="svc-ISAPI-4.0_32bit" />
    

    (or, if on win64:)

    <remove name="svc-ISAPI-4.0_64bit" />
    

    And, in the <modules> element:

    <remove name="ServiceModel-4.0" />