none
CDN for Hosted Service Webconfig Causes 500 errors

    Question

  • I setup CDN for my WebRole around 12 hours ago. I then copied all static scripts and content into the cdn folder that I made on the root. I placed a webconfig in the root of the cdn folder to specify public cache and 30 min caching.

    Every time I go to the URL provided by Microsoft I get 500 errors. 

    I changed all the urls in my application to use the cdn folder. But can't get anything to show up. I don't know where to go from here.

    Really I should be able to hit this link: az415522.vo.msecnd.net/Scripts/jquery-1.6.2.js or az415522.vo.msecnd.net/Images/favicon.png but nothing works. Its as if the CDN never got created. Someone please help.

    Am I missing something?


    Sunday, April 28, 2013 3:38 PM

All replies

  • Can anyone help?  Please
    Monday, April 29, 2013 2:20 AM
  • If your static content is not changing frequently, I would suggest you to setup higher Cache limit may be for an year and this will help you to load content faster.

    And the link below explain more on how to do for Windows Azure CDN: http://blogs.msdn.com/b/windowsazure/archive/2011/03/18/best-practices-for-the-windows-azure-content-delivery-network.aspx


    Yang Yang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, April 29, 2013 6:57 AM
    Moderator
  • Ok so after messing around I found my problem. If I remove the Web.config file from the cdn folder then everything shows up and loads. But I do need to be able to set caching expiration headers for the content. Below is my web.config that I am using. Am I doing something wrong? 

    <?xml version="1.0"?>
    <configuration>
      <system.web>
        <system.webServer>
          <staticContent>
            <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="0.02:00:00" />
          </staticContent>
        </system.webServer>
      </system.web>
    </configuration>

    Even with setting the expiration from 30 min to 2 hours it still doesn't work. 

    Also how do I confirm that the content is serving from the CDN in the first place. If I look using Fiddler it still states that it is coming from my site. I don't see that I know for sure it is coming from the CDN. Please direct me in the right direction.

    Thanks,

    Steven

    Monday, April 29, 2013 8:09 AM
  • Any additional help on this would be great. I have everything working except if I put a webconfig in the root of my cdn folder. I need to be able to specify cache control and maxage. 

    Can someone please help out.

    Wednesday, May 8, 2013 3:40 PM
  • anyone??? Microsoft???
    Friday, May 10, 2013 4:53 PM
  • Hi Steven,

    Your WebApp web.config appears to be fine. Are you using relative or absolute URLs for your static resources?

    Quick tip:

    For jQuery, you can use http://www.asp.net/ajaxlibrary/cdn.ashx. It's free!


    Best Regards,
    Carlos Sardo



    Monday, May 13, 2013 7:13 PM
  • I am using all relative URLs.

    like below.

    "~/cdn/jquery/script.js"

    Monday, May 13, 2013 7:51 PM
  • I am using all relative URLs.

    like below.

    "~/cdn/jquery/script.js"

    Hi Steven,

    That's the problem then. Having relative URLs, means that the request will go to your original WebApp Host (yourweb.cloudapp.net/cdn/...).

    You need to specify the actual CDN endpoint: az123e423432...



    Best Regards,
    Carlos Sardo

    Tuesday, May 14, 2013 7:57 AM