Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
378 views
in Technique[技术] by (71.8m points)

httphandler - AjaxToolkit IIS7 Asp.Net 4.0: Sys is not defined; handler mapping issue?

I have moved my asp.net 3.5 app to asp.net 4.0 and moved from windows 2003 (iis6) to windows 2008 r2 (iis7.5) and now i have this sys is undefined error.

i have the app running in an integrated application pool. everything works except my ajaxtoolkit 3.0.20820.0 dll

now I have read several blog posts, most of them cover asp.net 2.0 web.config files and not the minimized asp.net 4.0 config files.

here are some parts from my current config file:

<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
    <add name="AjaxToolkit" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add name="ChartImg" verb="*" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"  />
</handlers>

and another part:

<httpHandlers>
    <remove verb="*" path="*.asmx"/>
    <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    <add verb="GET" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler" validate="false"/>
    <add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
</httpHandlers>

There is not much info available for asp.net 4.0 and ajaxtoolkit http handler issue, so I hope some guru @ stackoverflow can help me out :)

EDIT:

since I have this stupid sys undefined thing, my global.asax gives this on_Error:

Error Message: This is an invalid script resource request.
Stack Trace:
at System.Web.Handlers.ScriptResourceHandler.ProcessRequest(HttpContext context) 
at System.Web.Handlers.ScriptResourceHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext context) 
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) 

it's on scriptresource.axd files :S

Edit2: the strange thing is that my local web.config hasn't got any handler stuff in the web.config and it runs on the development webserver casini

Edit 3: people say that Adrian has the solution here: http://budigelli.wordpress.com/2007/05/01/error-sys-is-undefined-error/ but I can't get it to work on IIS7

Edit 4: I've read somewhere that IIS7 has a wildcard mapping at Handler mapping I have seen that there is an extensionless wildcard mapping in de sorted list above the .axd mapping. but now I still don't know how to configure the mappings in IIS7 to support the Ajaxtoolkit!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

For asp.net 4.0 on IIS 7 and IIS 7.5 add this to your web.config:

<system.webServer>
            <handlers>
                <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
            </handlers>
</system.webServer>

UPDATE: I have changed the version to the correct version for ASP.NET 4.0


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...