views:

258

answers:

4

Hello everybody,

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!

A: 

I am having the same exact problem and I haven't been able to find a solution for it anywhere. I hope someone can come up with a solution.

Jeremy
This looks like a good solution: the only (big) downside is that it is based on asp.net 3.5 and not 4.0 with the minimal web.config. this is really hard to trouble shoot. forgot the url: http://stackoverflow.com/questions/1262740/asp-net-element-name-is-not-a-known-element
JP Hellemons
Did you get this to work for 4.0?
Jeremy
not yet, but will update this thread if it works :)
JP Hellemons
+1  A: 

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

Jeremy
Hello Jeremy, are you sure it should be version 1.0? the strange thing it that the same webapp works locally on my windows 7 x64 asp.net 4 (with build in dev.webserver) but doesn't work remote on IIS
JP Hellemons
JP, You are right, it should be version 4.0.0.0 not 1.x. I fixed the above to reflect that.
Jeremy
A: 

OK solved it: I found this comment of Cassiano at this URL: http://madskristensen.net/post/Optimize-WebResourceaxd-and-ScriptResourceaxd.aspx

and then I realized that I had the URL rewriting extension in IIS7 which appended a trailing slash to everything. (the rule was generated by the wizard of the rewriting component)

here is my current web.config parts which i used and had ajaxtoolkit to work:

<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="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 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>
<httpModules>
    <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</httpModules>

and this part:

<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules>
        <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    </modules>
    <handlers>
        <remove name="WebServiceHandlerFactory-Integrated" />
        <add name="test jp" path="*.axd" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv4.0,bitness32" />
        <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        <add name="ScriptResource" preCondition="integratedMode" 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>

rule number 10 : http://stackoverflow.com/questions/3822733/ajaxtoolkit-iis7-asp-net-4-0-sys-is-not-defined-handler-mapping-issue

JP Hellemons
A: 

JP, I have seen this solution but it is for ASP.Net 3.5. If you notices in the web.config you posted the version of ScriptResource.axd is 3.5.0.0. This may still work but it is referencing the 3.5 libraries instead of the 4.0 libraries.

-Jeremy

Jeremy
Hi Jeremy, it was an 3.5 web app which was migrated to 4.0. sorry that i've left out that info. but how should the references be for a 4.0 dll? and can i safely migrate the ajaxtoolkit from 3.5 to 4?
JP Hellemons
As far as I've seen so far, yes. Refer to my answer above.
Jeremy