C# HTTPHandler在IIS 7.5上使用system.webserver失败

C# HTTPHandler在IIS 7.5上使用system.webserver失败,c#,asp.net,.net,c#-4.0,C#,Asp.net,.net,C# 4.0,当我尝试访问any.asmx以及自定义http处理程序时,出现以下错误。我已经把它移到system.webserver了。。有什么想法吗 HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid. <add name="UrlRoutingModule-4

当我尝试访问any.asmx以及自定义http处理程序时,出现以下错误。我已经把它移到system.webserver了。。有什么想法吗

HTTP Error 500.19 - Internal Server Error

The requested page cannot be accessed because the related configuration data for the page is invalid.
    <add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="managedHandler" />
HTTP错误500.19-内部服务器错误
无法访问请求的页面,因为该页面的相关配置数据无效。
Web.Config:

<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <configSections>
    <section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
  </configSections>
  <connectionStrings>
  </connectionStrings>
  <system.web>
    <customErrors mode="Off"></customErrors>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Speech, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      </assemblies>
    </compilation>
    <httpRuntime maxRequestLength="2147483647"/>
    <webServices>
      <protocols>
        <add name="HttpGet"/>
        <add name="HttpPost"/>
      </protocols>
    </webServices>
  </system.web>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <handlers>
      <add name="SpartHandler" verb="*" path="*.sparta" type="SpartaMessage_WebServices.IHTTPTransfer, SpartaMessage_WebServices" resourceType="Unspecified"/>
    </handlers>
  </system.webServer>
  <system.net>
  </system.net>
</configuration>

不要将处理程序放在system.webServer中,而是将httpHandlers放在system.web中:

  <system.web>
    ...
    <httpHandlers>
      <add name="SpartHandler" verb="*" path="*.sparta" type="SpartaMessage_WebServices.IHTTPTransfer, SpartaMessage_WebServices" resourceType="Unspecified" />
    </httpHandlers>
  </system.web>

...