系统WIN7,开发工具Visual Studio 2013(Framework都是选择的4.5、默认的IIS Express),我想配置一个处理程序,专门来处理一类访问,但是配置后没反应 调试进入不了自定义的Handle文件。 但是用系统win2003 server,开发工具Visual Studio 2010(Framework都是选择的3.5、默认的ASP.NET Development Server)同样的代码就一切OK。
config文件中Handlers中配置如下:
<?xml version="1.0" encoding="utf-8"?>
<!-- 有关如何配置 ASP.NET 应用程序的详细信息,请访问 http://go.microsoft.com/fwlink/?LinkId=169433 -->
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > <section name="Sdk.Web.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<appSettings>
<add key="strconn" value="server=192.168.100.20;database=db;uid=sa;pwd=123"/>
<add key="AjaxHttpHandler" value="zn.Fybx.Rule"/> </appSettings> <system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
<add name="AscxHttpHandler" verb="GET,POST" path="*.ascx" type="zn.Web.AscxHttpHandler,zn.Web"/>
<add name="AjaxHttpHandler" verb="GET,POST" path="*.ajax,*.json," type="zn.Web.AjaxHttpHandler,zn.Web"/>
</handlers>
<httpErrors errorMode="Custom" > <remove statusCode="401" subStatusCode="-1" /> <remove statusCode="403" subStatusCode="-1" /> <remove statusCode="404" subStatusCode="-1" /> <remove statusCode="500" subStatusCode="-1" />
<error statusCode="401" path="/401.html" responseMode="ExecuteURL" /> <error statusCode="402" path="/402.html" responseMode="ExecuteURL" /> <error statusCode="403" path="/403.html" responseMode="ExecuteURL" /> <error statusCode="404" path="/404.html" responseMode="ExecuteURL" /> </httpErrors> <security> <requestFiltering > <requestLimits maxAllowedContentLength="1073741824" ></requestLimits> </requestFiltering> </security> </system.webServer> <system.web> <compilation debug="true" targetFramework="4.5" />
<!--<httpHandlers> <add verb="GET,POST" path="*.ascx" type="zn.Web.AscxHttpHandler,zn.Web"/> <add verb="GET,POST" path="*.ajax,*.json," type="zn.Web.AjaxHttpHandler,zn.Web"/> </httpHandlers>--> <webServices> <protocols> <add name="HttpGet"/> <add name="HttpPost"/> </protocols> </webServices> <globalization requestEncoding="UTF-8" responseEncoding="UTF-8" fileEncoding="UTF-8" culture="zh-CN" uiCulture="zh-CN"/>
<!--<customErrors mode="On" defaultRedirect="/404.html"> <error statusCode="401" redirect="/401.html" /> <error statusCode="402" redirect="/402.html" /> <error statusCode="403" redirect="/403.html" /> <error statusCode="404" redirect="/404.html" /> </customErrors>--> <httpRuntime requestValidationMode="2.0" maxQueryStringLength="2097151" maxRequestLength="10097151" executionTimeout="18000" />
<pages validateRequest="false" /> </system.web> <!--<location path="/tab.aspx"> <system.web> <compilation debug="true" targetFramework="2.0" /> <globalization requestEncoding="gb2312" responseEncoding="UTF-8" culture="zh-CN" fileEncoding="UTF-8" uiCulture="zh-CN"/> <httpRuntime requestValidationMode="2.0" maxQueryStringLength="2097151" maxRequestLength="2048000" executionTimeout="18000" /> </system.web> </location>--> </configuration>
path="*.ajax,*.json," 貌似不能写多个
path="*.ascx" 优先级不够或者是被拦截的后缀,删除系统自带的*.ascx配置或修改拦截配置