2012-08-14 5 views
3

ScriptManager에서 EnableCdn 속성을 사용하려고합니다. 기본적으로 내 마스터 페이지 파일에이 코드 조각이 :ScriptManager EnableCdn - SSL에서 작동하지 않습니다.

<asp:ScriptManager ID="MainScriptManager" runat="server" EnablePartialRendering="true" 
    EnableScriptGlobalization="true" EnableScriptLocalization="true" AsyncPostBackTimeout="3600" EnableCdn="True"> 

이것은 우리가 HTTP를 통해 연결 dev에 환경에서 작동합니다 - 그것은 같은 스크립트에 대한 참조 :

<script src="http://ajax.aspnetcdn.com/ajax/4.5/5/WebForms.js" type="text/javascript"></script> 

그러나 프로덕션 서버에

<script src="https://ajax.microsoft.com/ajax/4.0/2/WebForms.js" type="text/javascript"></script> 

두 differencies있다 (버전 및 도메인), 그러나 버전 4.0에서 모든 파일의 대부분은 CDN의 SERV에없는 : 우리가 SSL을 사용하는 경우, 그러한 스크립트가 포함하려고 어 (https!를 통해).

누구나이 문제에 대한 해결책을 제안 할 수 있습니까? 버전 4.0은 https를 통해 지원되지 않지만 HTTP를 통해 지원됩니다 (두 가지 방법으로 버전 4.5에서 파일을 다운로드 할 수 있지만 4.0은 HTTP를 통해서만 사용할 수 있음).

편집 : "ajax.microsoft.com ajax.aspnetcdn.com로 변경"

내가 찾은 정보 것을 -이 내 버전에 문제가 될 것으로 보인다하지만 난 방법을 변경하려면 정보 (아직)를 찾을 수 없습니다 올바른 도메인으로 도메인. 제작에 프레임 워크를 다시 설치해야합니까?

+0

프로덕션 환경에서 개발 환경과 동일한 버전의 .NET이 실행되고 있는지 확인할 수 있습니까? Dev 환경에서 .NET 4.5 RC를 실행하고 프로덕션 환경에서 .NET 4.0을 실행하는 것처럼 보입니다. –

+0

문제가있는 것 같습니다. - 릴리스 팀에게 프로덕션 환경에 .NET 4.5 RTM을 설치하도록 요청했습니다. – tomkuj

답변

0

도 4.0과 동일한 문제가 발생합니다.이 문제는 ajax.microsoft.com에 대한 참조가 프레임 워크 자체에 의해 지정되어있는 것을 수정하는 방법을 나타내는 것을 찾을 수 없습니다.

+0

.NET 4.5 RTM을 설치하고 문제가 아직 있는지 확인합니다. – tomkuj

6

파일의 은 서버에입니다.하지만 최근에는 매우 신중한 행동을 보였으므로 (모든 파일에 액세스 할 수 없음) 항상 로컬 장애 조치를 사용하십시오. 닷넷 4.0

은 당신의 Global.asax 파일이 추가 - 그것은 새로운 하나 모든 CDN 도메인을 업데이트 (이전 버전은 적절하게 링크 변경을 위해) :

protected void Application_Start(object sender, EventArgs e) 
{ 
    System.Reflection.Assembly web = typeof(HttpApplication).Assembly; 
    ScriptManager.ScriptResourceMapping.AddDefinition(
     "WebForms.js", 
     web, 
     new ScriptResourceDefinition 
     { 
      ResourceName = "WebForms.js", 
      ResourceAssembly = web, 
      CdnPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/WebForms.js", 
      CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/WebForms.js", 
      CdnSupportsSecureConnection = true 
     } 
    ); 
    ScriptManager.ScriptResourceMapping.AddDefinition(
     "Focus.js", 
     web, 
     new ScriptResourceDefinition 
     { 
      ResourceName = "Focus.js", 
      ResourceAssembly = web, 
      CdnPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/Focus.js", 
      CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/Focus.js", 
      CdnSupportsSecureConnection = true 
     } 
    ); 
    ScriptManager.ScriptResourceMapping.AddDefinition(
     "SmartNav.js", 
     web, 
     new ScriptResourceDefinition 
     { 
      ResourceName = "SmartNav.js", 
      ResourceAssembly = web, 
      CdnPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/SmartNav.js", 
      CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/SmartNav.js", 
      CdnSupportsSecureConnection = true 
     } 
    ); 
    ScriptManager.ScriptResourceMapping.AddDefinition(
     "WebUIValidation.js", 
     web, 
     new ScriptResourceDefinition 
     { 
      ResourceName = "WebUIValidation.js", 
      ResourceAssembly = web, 
      CdnPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/WebUIValidation.js", 
      CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/WebUIValidation.js", 
      CdnSupportsSecureConnection = true 
     } 
    ); 
    ScriptManager.ScriptResourceMapping.AddDefinition(
     "TreeView.js", 
     web, 
     new ScriptResourceDefinition 
     { 
      ResourceName = "TreeView.js", 
      ResourceAssembly = web, 
      CdnPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/TreeView.js", 
      CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/TreeView.js", 
      CdnSupportsSecureConnection = true 
     } 
    ); 
    ScriptManager.ScriptResourceMapping.AddDefinition(
     "Menu.js", 
     web, 
     new ScriptResourceDefinition 
     { 
      ResourceName = "Menu.js", 
      ResourceAssembly = web, 
      CdnPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/Menu.js", 
      CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/Menu.js", 
      CdnSupportsSecureConnection = true 
     } 
    ); 
    ScriptManager.ScriptResourceMapping.AddDefinition(
     "MenuStandards.js", 
     web, 
     new ScriptResourceDefinition 
     { 
      ResourceName = "MenuStandards.js", 
      ResourceAssembly = web, 
      CdnPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/MenuStandards.js", 
      CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/MenuStandards.js", 
      CdnSupportsSecureConnection = true 
     } 
    ); 
    ScriptManager.ScriptResourceMapping.AddDefinition(
     "WebParts.js", 
     web, 
     new ScriptResourceDefinition 
     { 
      ResourceName = "WebParts.js", 
      ResourceAssembly = web, 
      CdnPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/WebParts.js", 
      CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/WebParts.js", 
      CdnSupportsSecureConnection = true 
     } 
    ); 
    ScriptManager.ScriptResourceMapping.AddDefinition(
     "GridView.js", 
     web, 
     new ScriptResourceDefinition 
     { 
      ResourceName = "GridView.js", 
      ResourceAssembly = web, 
      CdnPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/GridView.js", 
      CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/GridView.js", 
      CdnSupportsSecureConnection = true 
     } 
    ); 
    ScriptManager.ScriptResourceMapping.AddDefinition(
     "DetailsView.js", 
     web, 
     new ScriptResourceDefinition 
     { 
      ResourceName = "DetailsView.js", 
      ResourceAssembly = web, 
      CdnPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/DetailsView.js", 
      CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/DetailsView.js", 
      CdnSupportsSecureConnection = true 
     } 
    ); 
    System.Reflection.Assembly ext = typeof(ScriptManager).Assembly; 
    ScriptManager.ScriptResourceMapping.AddDefinition(
     "MicrosoftAjax.js", 
     ext, 
     new ScriptResourceDefinition 
     { 
      ResourceName = "MicrosoftAjax.js", 
      ResourceAssembly = ext, 
      CdnPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/MicrosoftAjax.js", 
      CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/MicrosoftAjax.debug.js", 
      CdnSupportsSecureConnection = true 
     } 
    ); 
    ScriptManager.ScriptResourceMapping.AddDefinition(
     "MicrosoftAjaxApplicationServices.js", 
     ext, 
     new ScriptResourceDefinition 
     { 
      ResourceName = "MicrosoftAjaxApplicationServices.js", 
      ResourceAssembly = ext, 
      CdnPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/MicrosoftAjaxApplicationServices.js", 
      CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/MicrosoftAjaxApplicationServices.debug.js", 
      CdnSupportsSecureConnection = true 
     } 
    ); 
    ScriptManager.ScriptResourceMapping.AddDefinition(
     "MicrosoftAjaxComponentModel.js", 
     ext, 
     new ScriptResourceDefinition 
     { 
      ResourceName = "MicrosoftAjaxComponentModel.js", 
      ResourceAssembly = ext, 
      CdnPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/MicrosoftAjaxComponentModel.js", 
      CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/MicrosoftAjaxComponentModel.debug.js", 
      CdnSupportsSecureConnection = true 
     } 
    ); 
    ScriptManager.ScriptResourceMapping.AddDefinition(
     "MicrosoftAjaxCore.js", 
     ext, 
     new ScriptResourceDefinition 
     { 
      ResourceName = "MicrosoftAjaxCore.js", 
      ResourceAssembly = ext, 
      CdnPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/MicrosoftAjaxCore.js", 
      CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/MicrosoftAjaxCore.debug.js", 
      CdnSupportsSecureConnection = true 
     } 
    ); 
    ScriptManager.ScriptResourceMapping.AddDefinition(
     "MicrosoftAjaxGlobalization.js", 
     ext, 
     new ScriptResourceDefinition 
     { 
      ResourceName = "MicrosoftAjaxGlobalization.js", 
      ResourceAssembly = ext, 
      CdnPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/MicrosoftAjaxGlobalization.js", 
      CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/MicrosoftAjaxGlobalization.debug.js", 
      CdnSupportsSecureConnection = true 
     } 
    ); 
    ScriptManager.ScriptResourceMapping.AddDefinition(
     "MicrosoftAjaxHistory.js", 
     ext, 
     new ScriptResourceDefinition 
     { 
      ResourceName = "MicrosoftAjaxHistory.js", 
      ResourceAssembly = ext, 
      CdnPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/MicrosoftAjaxHistory.js", 
      CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/MicrosoftAjaxHistory.debug.js", 
      CdnSupportsSecureConnection = true 
     } 
    ); 
    ScriptManager.ScriptResourceMapping.AddDefinition(
     "MicrosoftAjaxNetwork.js", 
     ext, 
     new ScriptResourceDefinition 
     { 
      ResourceName = "MicrosoftAjaxNetwork.js", 
      ResourceAssembly = ext, 
      CdnPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/MicrosoftAjaxNetwork.js", 
      CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/MicrosoftAjaxNetwork.debug.js", 
      CdnSupportsSecureConnection = true 
     } 
    ); 
    ScriptManager.ScriptResourceMapping.AddDefinition(
     "MicrosoftAjaxSerialization.js", 
     ext, 
     new ScriptResourceDefinition 
     { 
      ResourceName = "MicrosoftAjaxSerialization.js", 
      ResourceAssembly = ext, 
      CdnPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/MicrosoftAjaxSerialization.js", 
      CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/MicrosoftAjaxSerialization.debug.js", 
      CdnSupportsSecureConnection = true 
     } 
    ); 
    ScriptManager.ScriptResourceMapping.AddDefinition(
     "MicrosoftAjaxTimer.js", 
     ext, 
     new ScriptResourceDefinition 
     { 
      ResourceName = "MicrosoftAjaxTimer.js", 
      ResourceAssembly = ext, 
      CdnPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/MicrosoftAjaxTimer.js", 
      CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/MicrosoftAjaxTimer.debug.js", 
      CdnSupportsSecureConnection = true 
     } 
    ); 
    ScriptManager.ScriptResourceMapping.AddDefinition(
     "MicrosoftAjaxWebForms.js", 
     ext, 
     new ScriptResourceDefinition 
     { 
      ResourceName = "MicrosoftAjaxWebForms.js", 
      ResourceAssembly = ext, 
      CdnPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/MicrosoftAjaxWebForms.js", 
      CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/MicrosoftAjaxWebForms.debug.js", 
      CdnSupportsSecureConnection = true 
     } 
    ); 
    ScriptManager.ScriptResourceMapping.AddDefinition(
     "MicrosoftAjaxWebServices.js", 
     ext, 
     new ScriptResourceDefinition 
     { 
      ResourceName = "MicrosoftAjaxWebServices.js", 
      ResourceAssembly = ext, 
      CdnPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/MicrosoftAjaxWebServices.js", 
      CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/MicrosoftAjaxWebServices.debug.js", 
      CdnSupportsSecureConnection = true 
     } 
    ); 
    ScriptManager.ScriptResourceMapping.AddDefinition(
     "Date.HijriCalendar.js", 
     ext, 
     new ScriptResourceDefinition 
     { 
      ResourceName = "Date.HijriCalendar.js", 
      ResourceAssembly = ext, 
      CdnPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/Date.HijriCalendar.js", 
      CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/Date.HijriCalendar.debug.js", 
      CdnSupportsSecureConnection = true 
     } 
    ); 
    ScriptManager.ScriptResourceMapping.AddDefinition(
     "Date.UmAlQuraCalendar.js", 
     ext, 
     new ScriptResourceDefinition 
     { 
      ResourceName = "Date.UmAlQuraCalendar.js", 
      ResourceAssembly = ext, 
      CdnPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/Date.UmAlQuraCalendar.js", 
      CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/4.0/2/Date.UmAlQuraCalendar.debug.js", 
      CdnSupportsSecureConnection = true 
     } 
    ); 
} 
0

체크 아웃 this link

나는이 질문을 해결할 수 없다는 것을 알고있다. 그러나 이것은이 링크가 그것을 아주 잘 설명 할 때 우리가 그것을 어떻게 사용할 수 있는가를 조금 더 분명하게합니다. "Nikola Bogdanovic"이 언급 한 구문과 비슷하지만 CDN이 요청에 응답하지 않을 경우 사용할 로컬 경로도 포함됩니다.

예 : (샘플 코드) :

string str = "1.7.1"; 

ScriptManager.ScriptResourceMapping.AddDefinition("jquery", new ScriptResourceDefinition 

{ 

    Path = "~/Scripts/jquery-" + str + ".min.js", 

    DebugPath = "~/Scripts/jquery-" + str + ".js", 

    CdnPath = "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-" + str + ".min.js", 

    CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-" + str + ".js", 

    CdnSupportsSecureConnection = true, 

    LoadSuccessExpression = "window.jQuery" 

}); 
+0

.Net 4.5에'LoadSuccessExpression' 속성이 추가되었습니다. 아직 답장을 못했지만 ... 수동으로 로컬 페일 오버를 수행해야했습니다. –