Asp.net Ajax Control with reverse proxy (ARR) on IIS

0 Answers 149 Views
General Discussions ScriptManager and StyleSheetManager
End User
Top achievements
Rank 1
End User asked on 01 Aug 2022, 02:18 AM

Hi,

I have been throught a lot of trouble making work telerik controls with a proxy. I'm using asp.net webform on IIS with .net 4.5 and Telerik  2020.3.1021.45

I recently added a reverse proxy (ARR) to IIS to make my website work with the blue/green pattern to get a 0 downtime deployment. So I get a webfarm that redirect to the live website with the reverseproxy. Every things work great except telerik controls.

I get many javascript exception that make me think that the telerik webressource doesnt seems to get through the proxy :  

  • ASP.NET Ajax client-side framework failed to load
  • 'Sys' is undefined
  • “Telerik.Web.UI” is undefined

I tried to change many stuff but without sucess :

 

I don't know what to check next. Thank you for your advices/ideas...

 

JF

 

Rumen
Telerik team
commented on 01 Aug 2022, 11:14 AM | edited

Hi JF,

I hope you are doing well!

The "ASP.NET Ajax client-side framework failed to load" and "'Sys' is undefined" errors indicate that the MS AJAX client-side framework of ASP.NET Web Forms fails to load, which is a prerequisite for the Telerik ASP.NET AJAX components to run and operate. 

What you can try is to enable the Microsoft and Telerik CDN which will limit the use of web resources:

 

            <telerik:RadScriptManager
                runat="server"
                ID="RadScriptManager1"
                EnableCdn="true"
                CdnSettings-TelerikCdn="Enabled"
                >
            </telerik:RadScriptManager>
            <telerik:RadStyleSheetManager
                runat="server"
                ID="RadStyleSheetManager1"
                CdnSettings-TelerikCdn="Enabled">
            </telerik:RadStyleSheetManager>

 

You have to configure your app to work properly with Web Forms to be able to use our components. You can find more information on the scenario in the following online forums:

You can find more information for the third error in this KB article, but have in mind that it is due to the first and second ones for MS AJAX and should disappear automatically if you resolve them: JavaScript console error Telerik is not defined.

End User
Top achievements
Rank 1
commented on 03 Aug 2022, 02:13 AM

Thank you Rumen for your quick answer. I had to do many tests to ensure the solution was stable before getting you back.

As you said, adding EnableCdn and CdnSetting-TelerikCdn corrected the first 2 problems. However I still had the "Telerik.Web.UI is Undefined". I never succeed making it work so I didn't added that part in the end. I still followed your links and infos to get it work. 

Here's the final steps I took :

  1. First I added https CDN redirection in my web.config because since I had a loadbalancer, Telerik was generating http CDN that were blocked by the browser when I was in HTTPS. Telerik Web Forms CDN - RadScriptManager | Telerik UI for ASP.NET AJAX
<appsettings>       
    <!-- use secure Telerik CDN for scripts -->
    <add key="Telerik.ScriptManager.TelerikCdn.BaseUrl" value="https://d2i2wahzwrm1n5.cloudfront.net"  />   
    <add key="Telerik.ScriptManager.TelerikCdn.BaseSecureUrl" value="https://d2i2wahzwrm1n5.cloudfront.net"  />
    <!-- use secure Telerik CDN for styles and images -->
    <add key="Telerik.StyleSheetManager.TelerikCdn.BaseSecureUrl" value="https://d35islomi5rx1v.cloudfront.net" />
    <add key="Telerik.StyleSheetManager.TelerikCdn.BaseUrl" value="https://d35islomi5rx1v.cloudfront.net" />
</appsettings>

2. I changed the telerik WebResource.axd type from Telerik.Web.UI.WebResource toTelerik.Web.UI.WebResourceSession since I have loadbalancing. Telerik.Web.UI.WebResource.axd and web.config Once and for all in UI for ASP.NET AJAX | Telerik Forums

3.I changed all my RadScriptManager (old application with no masterPage, so many radScriptManager) to add the property enableScriptCombine="false".

<telerik:RadScriptManager EnableScriptCombine="false" runat="server" ID="RadScriptManager1">

4. I finally added CdnSetting-TelerikCdn="Enable" to all my radstylesheetmanager

<telerik:radstylesheetmanager runat="server" EnableStyleSheetCombine="true" CdnSettings-TelerikCdn="Enabled">

 

Hope this can help anyone else.

Thank you again and have a nice day,

JF

 

 

Rumen
Telerik team
commented on 03 Aug 2022, 08:03 AM

Hi JF,

Thank you for sharing your solution with the community!

I am glad that you managed resolved the three errors. I referred the thread to the Reverse Proxy (ARR) and Script Resource Issues article to serve as a reference with more tips.

Just wanted to add that the load-balancing configuration of the Telerik AJAX components is also discussed in the following blog post How to integrate RadControls for ASP.NET AJAX in a WebFarm or WebGarden scenario.

End User
Top achievements
Rank 1
commented on 03 Oct 2022, 07:03 PM

Hi Rumen,

I have done some changes to avoid using the Telerik CDN since we had some problems in the past with CDNs (and some with Telerik CDN and ajax stuff) . 

I have revert back the Telerik handler in the web.config to use WebResource instead of WebResourceSession as initially proposed in How to integrate RadControls for ASP.NET AJAX in a WebFarm o (telerik.com).

Since then, I have removed the "Telerik cdn" in the web.config and even the EnableScriptCombine="false" in my RadScriptManager.

I have done plenty of tests (by forcing to switch the requests handling from one webserver to another) on pretty much every Telerik controls in my application (most are RadTextBox, RadComboBox, RadButton, RadGrid  ,RadAjaxManager, AjaxUpdatedControl, RadSplitter).

It seems that all the problems I had I my first post were due to that. Is it still useful to change the Telerik handler in web.config? Is the 2013 post on web garden outdated? 

Thank you 

Rumen
Telerik team
commented on 04 Oct 2022, 03:08 PM

Thank you for the update!

Affirmative, the information in the How to integrate RadControls for ASP.NET AJAX in a WebFarm or WebGarden scenario blog post is still valid and up-to-date. If the Telerik controls work without issues with WebResource instead of WebResourceSession and with disabled CDN then it is perfectly fine to use them with their embedded resources.

No answers yet. Maybe you can help?

Tags
General Discussions ScriptManager and StyleSheetManager
Asked by
End User
Top achievements
Rank 1
Share this question
or